Understanding Joomla Template PositionsArticle Audience: Webmasters / Joomla Newbies This article is for Joomla 1.0. The Joomla 1.5 version of the article can be found here: http://www.dart-creations.com/joomla/joomla-tutorials/joomla-1.5-template-positions.html New users of Joomla tend to find template module positions confusing and possibly frustrating. This is because by default you get a large number of module positions however, when modules are assigned to these positions the modules are not shown. This article will attempt to clear the air about template module positions.
Module Positions
In the Joomla (1.0.x) administration site if you go to Site > Template Manager > Module Positions you will find a large list of module positions. These positions are then automatically read and then will be available when assiging a position to a module in Modules > Site Modules. However, just by having a large number of entries on your Module Positions page, does not automatically mean that you have these positions available in you pages. This is because it is your template which determines the positions available. To be able to use a position you must have something similar to the following in your template's source code <?php mosLoadModules ( 'center', -1 ); ?> (where center is the position) This means that any modules which are assigned to the center position will be rendered instead of that code in the template. Thus to know which modules are available for your use, you either need to read the documentation of your template, or else open the files of the template and check which positions are available with the template. The best thing to do is remove any positions not available from the Module Positions entries not to mix yourself up when assigning positions to your modules. If you require additional template positions, you would need to change your template to cater for the additional positions you need. Obviously, this requires knowledge of PHP and HTML in order not to break your template. Also note that you can usually add more than one module to the same position i.e. you can add more than one modules to your left and right positions, with the order in which they are displayed being determined by the Order parameter in the Module setup. Also note that in some poorly written templates the module positions do not agree exactly with the name given to the position (e.g. user position shows up at the bottom). It is up to the author of the template and the Joomla webmaster to understand where the module will be rendered by testing different module positions, and if necessary changing the name in the template code. Please be sure that you always take backups and know exactly what you are doing before changing any template files. Adding Module Positions
In this section I will show briefly how to create an new module position in the standard template. Determine where you are going to place the position in your template. You need to understand exactly how the tempalate works. For example we will be adding an adlinks position to my template (to insert Google AdSense adlinks code). We find the position where we want to add the adlinks and insert php / html code similar to the following: <!-- BEGIN: adlinks --> <div id="adlinks"> <div class="adlinks-class"> <?php mosLoadModules ( 'adlinks', -1 ); ?> </div> </div> <!-- END: adlinks --> We then need to create the Module Position in Site > Template Manager > Module Positions by creating a new adlinks entry
Once this is done, we can now assign a module to this position in the Modules > Site Modules page.
The end result is a new available module position in your template. The Easy Way OutTo create professional layouts quickly and easily, we highly recommend iJoomla Magazine. Whether you need to create an online magazine or just want to make Joomla a lot more powerful and useful, iJoomla Magazine is the ultimate solution. Go and take a look at it, we're sure you won't be sorry!
|