Jdoc statements and templatedetails.xml

Jdoc Statements are a little code snippet present in a template that tells joomla where to position content. Because this is a part of the template, these jdoc statements govern where positions and other output is positioned on all pages of your site.

Why do I need to know about this?

You can do so much more with a Joomla site by knowing a little bit about how the basic webpage is put together by Joomla. You can modify your template and make your site much more customized to your purpose. Take a peak at the nuts and bolts of your Joomla template (/templates folder in the root of your joomla installation's file system). Here you can add positions or change the structure of your template to better suited to your needs.

<jdoc:include />

Above is the basic jdoc statement. The statement also needs to have an attribute called type. This teels the template what type of content to display.

Different types


<jdoc:include type="component" />

This is the main output for the page and should only appear once. It would be silly to load a page with an article and see the article display twice.


<jdoc:include type="head" />

This tag should also appear only once in the <head> of the page all styles, scripts and meta tags for that page.


<jdoc:include type="message" />

This tag belongs in the <body> of the page and tells the template where to place system messages. This is generally positioned near the top center of a page on most templates.

Template Positions

The template positions are set in the templatedetails.xml file.

Below are some examples of module statements with module positions used frequently by Joomla! theme developers.

<jdoc:include type="modules" name="debug" />
<jdoc:include type="modules" name="sidebar-a" />
<jdoc:include type="modules" name="sidebar-b" style="rounded" />
<jdoc:include type="modules" name="showcase" style="xhtml" />
<jdoc:include type="modules" name="maintop" style="xhtml" />

You could add your own jdoc statement here to add a new position to your template. It's position in the xml document relative to the other jdoc statements determines where the position will show in your template. If you want to add a new position to the very top part of the page on your template. Your jdoc statement could go first before any of the other statements in the xml file.

Print Email