Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Tutorials arrow Joomla 1.5 Template Positions

Print E-mail

Understanding Joomla 1.5 Template Positions

Article Audience: Webmasters / Joomla Newbies

This is the Joomla 1.5 version of the Understanding Joomla Template Positions article for Joomla 1.0.x 

New users of Joomla tend to find template module positions confusing and possibly frustrating. Joomla 1.5 has improved the way templates work to ensure this is less confusing, however some users might still find it hard to add template positions to their templates. This article will attempt to clear the air about template module positions.

Module Positions

In the Joomla 1.5 Module Manager ( Extensions > Module Manager, you can assign your modules to a number of positions. As opposed to Joomla 1.0, where positions where defined at website level, the positions in Joomla 1.5 are defined per template. Thus the template positions problems is reduced, and responsibility is now with the template author to ensure that template positions defined in the template details file, actually exist in the template!

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, HTML and XML 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.

The JDOC tag

So what determines where modules are rendered. The JDOC tag in the index.php file is replaced by the modules assigned to that position (via Extensions > Module Manager and assigning to a particular position) when the page is being rendered. So if we have

<jdoc:include type="modules" name="left" style="xhtml"/>

in the index.php file, and the Main Menu module is assigned to the left position, the Main Menu will be displayed instead of this tag. This applies to each jdoc tag defined in the index.php file. If I have a <jdoc:include type="modules" name="right" style="xhtml"/>, this will be replaced by the modules which are assigned to the right position.

Logical Position Names

The name attribute in the jdoc tag, is a logical name. It is entirely possible to define the bottom position in the top part of the module, though typically template designers define tag names which make sense, i.e. the left position would eventually be displayed in the left area of the page, and the banner position would be displayed just above the content and so on.

How do I know what Positions my Template supports?

Typically, with serious template designers they explain which module positions are available in the template. In Joomla 1.5, the responsibility remains with the designer to define the correct positions in the template details file. However, for free templates, one might not know which positions actually exist. So how do you go about discovering which positions are supported by the template?

Simple open the template's index.php file, and search for the jdoc tag. Note the name of the places when the jdoc tag appears. I.e. if you find the following tags in the index.php file:

   <jdoc:include type="modules" name="top" style="xhtml" />

... 

   <jdoc:include type="modules" name="left" style="xhtml" />

  ...

<jdoc:include type="modules" name="banner" style="xhtml" />

.... 

   <jdoc:include type="modules" name="right" style="xhtml" />

You can safely assume that the positions supported by your template are:

  • top
  • left
  • banner
  • right 

Adding Module Positions

In this section I will show briefly how to create an new module position in any template.

You first need to decide where you are going to place the position in your template (in terms of the template's HTML). 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 (in the index.php) file 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">
    <jdoc:include type="modules" name="top" style="xhtml" />
   </div>   

 </div>
  <!-- END: adlinks --> 

 We then need to create the Module Position in the Template Details file by creating a new adlinks position. Find the TemplateDetails.xml file enclosed with you template under /templates/<templatename>/templateDetails.xml

Find the <positions> tag in your XML file. It looks something like this:

<positions>
      <position>left</position>
      <position>right</position>
      <position>top</position>
      <position>banner</position>
      <position>header</position>
      <position>footer</position>
      <position>pathway</position>
      <position>user1</position>
      <position>user2</position>
      <position>user3</position>
      <position>user4</position>
      <position>user5</position>
      <position>inset</position>
      <position>debug</position>
      <position>search</position>
      <position>debug</position>
</positions>

templatepositionjoomla15.jpgTo add your own position, you need to insert a new <position> tag before the closing positions tag. The end result will be as follows:

<positions>
      <position>left</position>
      <position>right</position>
      <position>top</position>
      <position>banner</position>
      <position>header</position>
      <position>footer</position>
      <position>pathway</position>
      <position>user1</position>
      <position>user2</position>
      <position>user3</position>
      <position>user4</position>
      <position>user5</position>
      <position>inset</position>
      <position>debug</position>
      <position>search</position>
      <position>debug</position>
      <position>adlinks</position>
</positions>  

Once this is done, we can now assign a module to the adlinks position in the Extensions > Module Manager page.

More information on how Joomla 1.5 templates work can be found in the 1.5 template Wiki page: http://docs.joomla.org/New_features_introduced_in_Joomla!_1.5_templates

So you want a good looking template? 

If you really want to look professional, stop searching for those free templates. Most of them look poor, are very limited in positions and flexibility, have bugs, and typically contain hidden links to the original designers. If you want your site to look great, go to the pros and get yourself a template from there. You won't be sorry, and the end result will definetely show. The first impression of a website is obviously from the template, and you really want to get the first impression right!

Template Designers

Joomlart

Our template (JA Pollux) was bought from JoomlaArt club. The good thing about this club is that you can subscribe to buy a 3 month membership. During this time you can download and try as many templates as you like. Also, Joomlart claim that they release 2 templates (or template updates) each month.

Joomlart

 

RocketTheme

When we were buying our template we had a difficult choice between, Joomlart, RocketTheme, and JoomlaShack. Take a look at RocketTheme templates ($50)

 

Comments
Add NewSearchRSS
alex - Pixel position of a new module IP:85.57.64.33 | 2008-03-07 13:49:47
How do you choose where is the pixel position of the new position?
DART Creations - Pixel postion IP:85.232.196.5 | 2008-03-07 14:15:07
Ideally this would be done via styles. Its difficult to just give an example of this, because its not something simple to explain.
mark - How to place an ad like the on IP:81.193.215.128 | 2008-03-10 09:40:45
How can I place an ad like the one you have on this site just above the article "Understanding Joomla 1.5 Template Positions"? I've been struggling with this for so long. Reading your article I now understand how to create a new module position. However, where do I find the place to paste the code you provide, in the index.php file? Thanks! Any kind of help would be appreciated.
DART Creations - Ad IP:85.232.196.5 | 2008-03-10 10:23:48
Mark, in this case we are using the Banner position of the template. Unfortunately, you'll need to understand how HTML works to know exactly where to put the code. I suggest you use some HTML program which allows you to visually see what changes you make, then experiment until you find the exact place to put it.
Dennis - Position name? IP:70.16.170.17 | 2008-04-03 10:16:26
Is there any correlation between the name attribute of the jdoc element/tag and the position name?



adlinks

Does this mean that "adlinks" is just another reference to where "top" is defined? Or that modules assigned to "adlink" will always be in the "top" position?
DART Creations - Position Name IP:85.232.196.5 | 2008-04-03 10:54:56
Yes there is a direct mapping between the positions defined, and the jdocs defined in the template's index file. That means that modules assigned to the adlinks position defined above, will be displayed instead of the jdoc include code.

The name means absolutely nothing, it is only a logical "tag" to an HTML position tag. You only give the positions meaningful names such as left, right, top, banner, bottom, footer etc to make it easier for yourself when you are assigning modules to the defined position.
Leigh - Thanks a lot IP:82.5.63.104 | 2008-04-15 07:34:35
Thanks for the clear and concise help.
Lerch2000 - Database IP:89.207.214.5 | 2008-04-17 07:32:28
Which table stores this information? I have direct access to my database and i want to manually setup more positions so that i can change the template i'm working on without having to keep re-installing it.
DART Creations - Position IP:85.232.196.5 | 2008-04-17 10:07:40
Lerch,

as explained in the article above, the position information is stored in none of the tables. It is part of the template, specifically templateDetails.xml file.
Write comment
Name:
Title:
Security Image
 

Subscribe to our feed


RSS Feed

DART Creations - Joomla Tutorials, Tips and Tricks and more...

Joomla Tips

DART Creations Joomla Tips, Tricks, tutorials and general Joomla help

Sponsors

Buy us a beer!

Lots of time and effort goes into creating and maintaining this site. If we've helped you, consider buying a beer. It will inspire us to keep on giving! Thanks! (€3)






Cheers ;)