Difference between revisions of "Jdoc statements"

From Joomla! Documentation

m (wikified formatting)
Line 3: Line 3:
  
 
== The type attribute ==
 
== The type attribute ==
The %%type%% attribute specifies the type of content to be rendered in place of the <jdoc:include /> element. For example, the <code><jdoc:include '''''type="head"''''' /></code> statement uses the type attribute head (<code>type="head"</code>)
+
The <tt>type</tt> attribute specifies the type of content to be rendered in place of the <jdoc:include /> element. For example, the <code><jdoc:include '''''type="head"''''' /></code> statement uses the type attribute head (<code>type="head"</code>)
  
 
=== Component ===
 
=== Component ===
<code>
+
<source lang="html4strict">
 
<jdoc:include type="component" />
 
<jdoc:include type="component" />
</code>
+
</source>
  
 
This element should only appear once in the <body> element of the Template to render the main content of the page with respect to the current page being viewed.
 
This element should only appear once in the <body> element of the Template to render the main content of the page with respect to the current page being viewed.
  
 
=== Head ===
 
=== Head ===
<code>
+
<source lang="html4strict">
 
<jdoc:include type="head" />
 
<jdoc:include type="head" />
</code>
+
</source>
  
 
This element should only appear once in the <head> element of the Template to render the content of the style, script and meta elements associated with the current page.
 
This element should only appear once in the <head> element of the Template to render the content of the style, script and meta elements associated with the current page.
  
 
=== Installation ===
 
=== Installation ===
<code>
+
<source lang="html4strict">
 
<jdoc:include type="installation" />
 
<jdoc:include type="installation" />
</code>
+
</source>
  
 
This element is only used within the Joomla! Installer template and of no particular use in a Front-end or Back-end template. It's somewhat the equivalent to the 'component' type, rendering the main content of an installation step.
 
This element is only used within the Joomla! Installer template and of no particular use in a Front-end or Back-end template. It's somewhat the equivalent to the 'component' type, rendering the main content of an installation step.
  
 
=== Message ===
 
=== Message ===
<code>
+
<source lang="html4strict">
 
<jdoc:include type="message" />
 
<jdoc:include type="message" />
</code>
+
</source>
  
 
This element should only appear once in the <body> element of the Template to render system and error messages that occurred in the request.
 
This element should only appear once in the <body> element of the Template to render system and error messages that occurred in the request.
  
 
=== Module ===
 
=== Module ===
<code>
+
<source lang="html4strict">
 
<jdoc:include type="module" name="breadcrumbs" />
 
<jdoc:include type="module" name="breadcrumbs" />
</code>
 
 
<code>
 
 
<jdoc:include type="module" name="menu" />
 
<jdoc:include type="module" name="menu" />
</code>
 
 
<code>
 
 
<jdoc:include type="module" name="submenu" style="rounded" id="submenu-box" />
 
<jdoc:include type="module" name="submenu" style="rounded" id="submenu-box" />
</code>
+
</source>
  
 
This element renders a single module given by the %%name%% attribute. The module in question must be published and accessible by the current user in order to become visible. Additional attributes can be provided to control the layout and appearance of the module, if supported.
 
This element renders a single module given by the %%name%% attribute. The module in question must be published and accessible by the current user in order to become visible. Additional attributes can be provided to control the layout and appearance of the module, if supported.
Line 54: Line 48:
 
Below are some examples of module statements with module positions used frequently by Joomla! theme developers.
 
Below are some examples of module statements with module positions used frequently by Joomla! theme developers.
  
 
+
<source lang="html4strict">
<code>
 
 
<jdoc:include type="modules" name="debug" />
 
<jdoc:include type="modules" name="debug" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="icon" />
 
<jdoc:include type="modules" name="icon" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="left" style="rounded" />
 
<jdoc:include type="modules" name="left" style="rounded" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="left" style="xhtml" />
 
<jdoc:include type="modules" name="left" style="xhtml" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="right" style="xhtml" />
 
<jdoc:include type="modules" name="right" style="xhtml" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="status"  />
 
<jdoc:include type="modules" name="status"  />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="syndicate" />
 
<jdoc:include type="modules" name="syndicate" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="title" />
 
<jdoc:include type="modules" name="title" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="toolbar" />
 
<jdoc:include type="modules" name="toolbar" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="top" />
 
<jdoc:include type="modules" name="top" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="top" style="xhtml" />
 
<jdoc:include type="modules" name="top" style="xhtml" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="user1" style="xhtml" />
 
<jdoc:include type="modules" name="user1" style="xhtml" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="user2" style="xhtml" />
 
<jdoc:include type="modules" name="user2" style="xhtml" />
</code>
 
 
<code>
 
 
<jdoc:include type="modules" name="user3" />
 
<jdoc:include type="modules" name="user3" />
</code>
+
</source>
  
[Note] The <code>name="user3"</code> module position is normally (by default) used for the top menu.
+
'''Note:''' The <code>name="user3"</code> module position is normally (by default) used for the top menu.
  
<code>
+
<source lang="html4strict">
 
<jdoc:include type="modules" name="user4" />
 
<jdoc:include type="modules" name="user4" />
</code>  
+
</source>
  
 
==== The style attribute ====
 
==== The style attribute ====
The optional <code>style=""</code> attribute is available for the module and modules types of <code><jdoc:include /></code> statements. The attribute value refers to the "chrome" style used to wrap the output generated by a module. If no style is provided, a value of "none" is used by default. The standard styles which are declared in %%/templates/system/html/modules.php%% include:
+
The optional <code>style=""</code> attribute is available for the module and modules types of <code><jdoc:include /></code> statements. The attribute value refers to the "[[Chrome|chrome]]" style used to wrap the output generated by a module. If no style is provided, a value of "none" is used by default. The standard styles which are declared in <tt>/templates/system/html/modules.php</tt> include:
  
  * table
+
* table
  * horz
+
* horz
  * xhtml
+
* xhtml
  * rounded
+
* rounded
  * outline
+
* outline
  
Template designers may add additional chrome names by adding a custom version of this file to %%/user-template/html/modules.php%%.
+
Template designers may add additional chrome names by adding a custom version of this file to <tt>/user-template/html/modules.php</tt>.

Revision as of 22:22, 19 January 2008

jdoc:include[edit]

The <jdoc:include /> statement is a Joomla! template's method of displaying content specific to the page being viewed. There are various <jdoc:include /> statements, each returning a different part of a Joomla! page.

The type attribute[edit]

The type attribute specifies the type of content to be rendered in place of the <jdoc:include /> element. For example, the <jdoc:include type="head" /> statement uses the type attribute head (type="head")

Component[edit]

<jdoc:include type="component" />

This element should only appear once in the <body> element of the Template to render the main content of the page with respect to the current page being viewed.

Head[edit]

<jdoc:include type="head" />

This element should only appear once in the <head> element of the Template to render the content of the style, script and meta elements associated with the current page.

Installation[edit]

<jdoc:include type="installation" />

This element is only used within the Joomla! Installer template and of no particular use in a Front-end or Back-end template. It's somewhat the equivalent to the 'component' type, rendering the main content of an installation step.

Message[edit]

<jdoc:include type="message" />

This element should only appear once in the <body> element of the Template to render system and error messages that occurred in the request.

Module[edit]

<jdoc:include type="module" name="breadcrumbs" />
<jdoc:include type="module" name="menu" />
<jdoc:include type="module" name="submenu" style="rounded" id="submenu-box" />

This element renders a single module given by the %%name%% attribute. The module in question must be published and accessible by the current user in order to become visible. Additional attributes can be provided to control the layout and appearance of the module, if supported.


Modules[edit]

Modules are rendered on a page using one of the following code examples. The modules are separated into different areas of a template using template positions set in the %%templatedetails.xml%% file. Using the jdoc:include's name="[template position name]" attribute, the various modules in their respective positions can be called, rendered, and styled separately. Additional attributes can be provided to control the layout and appearance of modules, if supported.

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="icon" />
<jdoc:include type="modules" name="left" style="rounded" />
<jdoc:include type="modules" name="left" style="xhtml" />
<jdoc:include type="modules" name="right" style="xhtml" />
<jdoc:include type="modules" name="status"  />
<jdoc:include type="modules" name="syndicate" />
<jdoc:include type="modules" name="title" />
<jdoc:include type="modules" name="toolbar" />
<jdoc:include type="modules" name="top" />
<jdoc:include type="modules" name="top" style="xhtml" />
<jdoc:include type="modules" name="user1" style="xhtml" />
<jdoc:include type="modules" name="user2" style="xhtml" />
<jdoc:include type="modules" name="user3" />

Note: The name="user3" module position is normally (by default) used for the top menu.

<jdoc:include type="modules" name="user4" />

The style attribute[edit]

The optional style="" attribute is available for the module and modules types of <jdoc:include /> statements. The attribute value refers to the "chrome" style used to wrap the output generated by a module. If no style is provided, a value of "none" is used by default. The standard styles which are declared in /templates/system/html/modules.php include:

  • table
  • horz
  • xhtml
  • rounded
  • outline

Template designers may add additional chrome names by adding a custom version of this file to /user-template/html/modules.php.