Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Tutorials arrow Joomla 1.5 Template Positions
Print E-mail
Saturday, 23 February 2008

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 

Joomla 1.5 Templates

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="adlinks" 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.

To quickly identify quickly template positions in your template, take a look at the following tip. http://www.dart-creations.com/joomla/joomla-tips-and-tricks/42-finding-your-joomla-template-positions.html

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 at least 1 new template each month.

Joomlart

 

 

Comments
Search RSS
alex  - Pixel position of a new module   |85.57.64.xxx |2008-03-07 19:49:47
How do you choose where is the pixel position of the new position?
DART Creations  - Pixel postion   |85.232.196.xxx |2008-03-07 20: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   |81.193.215.xxx |2008-03-10 15: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   |85.232.196.xxx |2008-03-10 16: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?   |70.16.170.xxx |2008-04-03 16: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   |85.232.196.xxx |2008-04-03 16: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   |82.5.63.xxx |2008-04-15 13:34:35
Thanks for the clear and concise help.
Lerch2000  - Database   |89.207.214.xxx |2008-04-17 13: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   |85.232.196.xxx |2008-04-17 16: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.
Mark  - Still Confused   |208.65.161.xxx |2008-06-19 00:01:27
From your example for creating a new 'adlinks' position, you add this to your
html code (between some ):



I just *cannot* see why you don't say
'name="adlinks"' there. What am I missing?
Mark  - Sorry, let me try that again..   |208.65.161.xxx |2008-06-19 00:03:15
..without the pointy brackets this time:

From your example for creating a new
'adlinks' position, you add this to your html code (between some
'divs'):

jdoc:include type="modules" name="top"
style="xhtml"

I just *cannot* see why you don't say
'name="adlinks"' there. What am I missing?
DART  - missprint   |Registered |2008-07-05 10:08:29
Hi Mark, you are right. There was a slight missprint in the article which has
been corrected. Thanks for attracting my attention to it.
Ian  - Please, help me   |83.241.25.xxx |2008-07-23 18:05:42
Hello,
I red the article, but unfortunately it didn't help me. The problem is
that I have to add a mainmenu to my template's left side where it was not
supposed to be at the beginning. I've tried several codes at index.php and css
and all I've got was the standard "left position" and it breaks my
template structure. Eventually I've figured out that it must be placed further
to the left (till the very end of the left side), like it's placed at your page.
So the question arises, where and what do I have to add? Where exactly I have to
change the horizontal and vertical position? in order to move the menu more to
the left?

please help me
Jedi Master  - Tks dude   |189.21.141.xxx |2008-07-29 16:59:30
Excelente Dude! my problem is solved!
Mihai   |89.123.129.xxx |2008-08-31 11:34:19
This is the best article I found on this subject ... ty, it cleared my mind

I
found out I was dealing with a broken template all along
mithalee  - How do i include a module in m   |59.92.248.xxx |2008-10-14 05:16:46
sir i am trying to include a module in my index.php file which is with the name
say leftmenu and has menu items a,b,c.The position is adlinks ...how do i
include it?
tastetwist  - how to center the new module   |69.247.76.xxx |2008-10-22 23:11:04
I did this and it worked but it is not centered - what is the code and where do
i put to center the new module?
DART  - center   |SAdministrator |2008-10-23 06:24:36
This is an HTML problem, and depends on the HTML you will be using for the
template.

Typically I use
DART   |SAdministrator |2008-10-23 06:42:58
align="center"
Ashwin  - tp=1   |61.17.195.xxx |2008-10-26 06:53:41
You can find what positions are defined in the index.php file of the template by
going to www.yourjoomlasite.com/index.php?tp=1

Note that if the xml file does
not have psitions defined and the index.php calls those positions they will
still show up in the above pabe
Jhazzi  - Error Message     |97.95.237.xxx |2009-01-18 21:32:47
Hello,

First, thank you for providing these tutorials/instructions. I am new to
what I am doing but copied the files and tried to edit them for the module
position I wanted to create. I get this error: XML Parsing Error at 84:23. Error
7: mismatched tag

It shows under template manager and modules manager.

I did
not find in the template.xml file anything close to "positions". I
looked at the Joomla default template file and the one I'm working with and they
only show: text.

This must be my problem. I do not see a list of module
positions as in your example. What must I do, please?

Thanks again.
Jhazzi
DART  - Error Message   |Administrator |2009-01-19 12:28:57
Jhazzi,

make sure you are using a Joomla 1.5 template. The positions tag
should be found in templateDetails.xml

If you are using a Joomla 1.0
template, we have another tutorial
here:

http://www.dart-creations.com/index.php?o
ption=com_content&task=view&id=33&Itemid=47
Jhazzi  - Error Message     |97.95.237.xxx |2009-01-19 16:12:46
Thanks for replying. I am using J1.5 and a J1.5 template. I am not even using
the Legacy Mode so I believe a J1.0 template would not work at all.

I opened
all of the templateDetails.xml files for each template I have (2 by default on
install and 2 that I uploaded) and none of them have these positions shown. All
of them list filenames but not positions.
DART  - Template Positions   |Administrator |2009-01-19 17:16:53
I'm quite surprised at this. Can you tell me which templates you are using, so I
can take a look at them and update you?
Jhazzi  - Module Positions     |97.95.237.xxx |2009-01-19 17:54:59
I can't help but believe I am overlooking the obvious because of your
expertise.

beez 1.0.0 19 February 2007 Angie Radtke/Robert
Deutz

JA_Purity 1.2.0 12/26/07 JoomlArt.com

JA Sargas 1.4 15 Feb 2008
JoomlArt.com

pwc-reka Default 1.0.0 12/2008
proWebCreative.com

rhuk_milkyway

As you can see, pwc-reka is the one set as
my default. It has such limited modules. I have a developer account at JoomlaArt
(a gift) and used the QuickStart install which uploads Joomla and the template
in a single upload. My sister didn't like it so I chose the default which she
likes but it limits me tremendously. I'd love to add 3 module positions but have
no idea until I came across your site.

I am forever amazed and grateful at the
generosity of total strangers since working with Joomla and phpbb3. I am greener
than green at this but manage with people like you helping out. Thank you!

Kind
regards,
Jhazzi
DART  - Positions   |Administrator |2009-01-19 19:01:47
Well in rhuk_milkyway, the positions tags are definetely in the
templateDetails.xml file! They are just after filenames, and before params.
Jhazzi  - Module Positions     |97.95.237.xxx |2009-01-19 19:35:31
I also found them in JA Purity but not the default or other ones. At least I
know what they look like but what do I do now? Do I add them to my default
template? (I will backup the site now as I'm advanced in building it since
yesterday.)

My apologies.
DART  - Positions   |Administrator |2009-01-19 20:40:24
Yes, add them to the template which you are using as default.
Jhazzi  - Mod Positions   |97.95.237.xxx |2009-01-19 20:43:45
Thank you for your time and help.
Tektoniq     |76.186.226.xxx |2009-01-30 17:42:15
Thanks for much for this write-up.

It's been extremely helpful for a Joomla
beginner like myself.

I understood the concepts of modules and positions, even
adding new modules via the templateDetails.xml file, but could not wrap my head
around how to define new module positions. Now I realize it is just part of the
styles (div, etc.) within the index's HTML.

VERY HELPFUL!
CB
Jhazzi  - Adding Module Positions     |97.95.237.xxx |2009-01-30 17:52:07
Okay, it's me again. I added the positions I wanted to the templatedetails.xml
file. Is that it? They do not show up when I do the ?tp=1 to see if they are
defined. Must I add them somewhere else, too?
Jhazzi  - Added Module positions not shown on template     |97.95.237.xxx |2009-01-30 17:53:10
Okay, it's me again. I added the positions I wanted to the templatedetails.xml
file. Is that it? They do not show up when I do the ?tp=1 to see if they are
defined. Must I add them somewhere else, too?
DART  - JDOC Tag   |Administrator |2009-01-31 08:18:03
You need to add the JDOC tag to the index.php file of your template too as
explained in the article.
Jhazzi   |97.95.237.xxx |2009-01-31 13:31:32
Thank you. This sounds ridiculous but this is the first time I've seen any part
of the article above "Adding Module Positions" section. I knew it seemed
too simple because I could do that part.
sameer  - diagram of postions list of JA_Purity template     |58.27.153.xxx |2009-02-05 17:06:24
any body can provide the complete diagram indicating positions of JA_Purity
template.
DART  - JA_Purity   |Administrator |2009-02-05 18:39:52
Best is to ask at Joomlart
everett  - my templatedetails.xml doesnt have positions     |68.4.113.xxx |2009-02-20 20:01:28
here is the dreaded free template i am using ( limited budget
)

http://www.prowebcreative.com/terms-of-use/58-f...

ihave read and reread your article ( very helpful!) and some others who
say the same thing.

but it truely seems that my template has no
positions listed in the templatedetails.xml ( the only xml file in the zip
)

the positions are found in the index.php file only!

does
ths mean i simpley need to load the positions into the index.php
file?

and could you tell me where i would need to place a jdoc tag to
get a top content centered module like http://jeejuh.com

please be a hero!
Fred   |85.230.231.xxx |2009-02-22 13:25:25
You can add defintions yourself.

Another possibility, correct the template
yourself, it's fairly easy :
Edit the file "templateDetails.xml"

Add
the following lines at the end of the file, juste before the closing tag :



YourChoice1
YourChoice2
YourChoice3
everett  - um, i guess you dont get it   |68.4.113.xxx |2009-02-22 18:00:46
my template doesnt utilize the templatedetails.xml for positions. it seems all
the jdoc positions are set by the css file and the index.php
Fred   |85.230.231.xxx |2009-02-22 18:55:47
Correct the CSS and index.php always control the locaction, however you said
that templateDetails.xml didn't contain any position definitions.

So my point
is that they (the position definitions) are easy to add (they will appear in the
postion drop down for each module in the Joomla admin interface) and then all
you do is experiment with the CSS and index.php it is not that tricky, if you
have a basix Css and php/hmtl understanding.

Good luck
everett  - but...   |68.4.113.xxx |2009-02-22 19:50:51
if my template is written in a way that the templatedetails.xml doesnt control
the positions, then why would i add them there? wouldnt i just add them to the
php and css files like all the other positions?
Dave   |85.189.227.xxx |2009-02-26 14:36:38
templatedetails.xml does not control the positions in any way. It simply lists
them and this list appears in the 'positions' dropdown list when you edit a
module in Joomla. This just makes it easier, especially if someone else is
trying to alter the site.
Dave   |85.189.227.xxx |2009-02-26 14:45:07
Ok, when I said it doesn't control them I lied. If you select a position from
the dropdown, the module will appear in that position. What I mean is that what
you put in the templatedetails.xml file will not affect the positions that are
created on the site, just the menu in Joomla.
DART  - Positions   |Administrator |2009-02-27 06:45:52
Basically, adding the positions which exist in the index.php to the
templatedetails.xml makes it "easier" to understand.
everett  - ok   |68.4.113.xxx |2009-03-03 05:46:48
i have tried to edit my template xml, when i copy and paste it into a text
editor and modify, it comes back un-readable. is there a free program i can use
to edit xml?

and by adding it to the template.xml, do i also have to add them
into the php and css? cuz, i really have no idea how to do that. especially the
css.

i tried just adding a jdoc line into the index.php, it didnt break the
template, and it added the position to my menu, but when i looked at the site
live, the module wasnt there!

is there a super blank template i can buy with
ALL the positions in it?

thanks so much everybody!
Fred  - Thanks!!!   |85.230.231.xxx |2009-02-22 13:23:34
Thanks for this great article. It solved my login problem.

Some templates lack
proper position definitions, like the one I'm using. Easy enough to add. See
http://www.gelono.com/en/joomla-templates/1.5/free
/download/j15sitegroundj1512.html for more details.

After that it is just a
matter of adding in the index.php It is really easy. Just play
around.

Cheers,
Fredrik
Anbu   |61.17.226.xxx |2009-03-20 10:26:10
Thank you for the article, It really helps !! :-D
Krishna Bhattarai  - About Custom Tag     |202.70.88.xxx |2009-03-30 04:47:47
How can i create custom tag like in joomla.
i want to use
sumera  - locus     |122.162.137.xxx |2009-03-30 10:17:56
i am using a ja_edenite template in my joomla 1.5, i want to use a banner
between main navigation and menu other than given positions,but copmletely
unable to do this. Plz help.
univo.alex  - re: Position Name   |212.117.158.xxx |2009-04-27 06:10:53
DART Creations wrote:
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.

You can use J!Position for easy drag and drop modules.
st_hart     |125.163.226.xxx |2009-06-02 03:10:32
Great tutorial! I applied it on my website and it works Thanks so much.
Kevin  - New Position Not Showing Up     |69.3.96.xxx |2009-06-09 22:52:03
Very helpful tutorial. It explained clearly what I couldn't figure out from a
few others.

Here's my question:

I added a new position to my website called
"half-banner". It's a banner position that is supposed to be at the
top-right of my page. When I view the site normally, it does not show up.
However, when I do ?tp=1 I can see the position and the banner module that is
loaded in it. Any ideas on what I'm doing wrong? The website is
cwstaging.com

Thanks in advance.
Kevin     |69.3.96.xxx |2009-06-09 22:59:42
Doh! I just found my mistake. I forgot to rename the name to
"half-banner" following "countModules" after I copied and pasted
the jdoc code in index.php. Thanks again for a great tutorial.
cobarde  - inserting content     |190.166.189.xxx |2009-07-09 00:06:10
Your Adding Module Positions, seems to be working. Now how do I insert the
Panoramic Image Viewer {bepiv}panorama/panorama.jpg{/bepiv}, into it? Nothing I
do works. I've tried making a article, but the adlinks isn't one of the options
in the section dropdown, I tried making a Custom Module and insert the PIV call
in the editing area provided. I can get it to work in an ordinary article on the
front page with no problem, but not the in new adlinks position. The website:
http://www.dintel.gov.do Hope someone can help.
DART   |Administrator |2009-07-09 08:41:40
I don't think you can use plugins within module positions in Joomla 1.5
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Wednesday, 23 September 2009 )
 

Sponsors

Login Form






Lost Password?
No account yet? Register

Buy us a beer!

If we've helped you, consider buying a beer €3. It will inspire us to keep on giving! Cheers!


Generated in 0.35471 Seconds