Actions

Difference between revisions of "Declaring module positions"

From Joomla! Documentation

(New page: ===== Declaring module positions ===== In order for Module positions to be available for selection in the Module Manager they must be declared in the templateDetails.xml file for your tem...)
 
m (grammar)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
===== Declaring module positions =====
+
The [[Creating a basic templateDetails.xml file|templateDetails.xml]] file contains all the installation and core information for a template. In order for Module positions to be available for selection in the Module Manager, the positions must be declared in the <code>templateDetails.xml</code> file of the template. 
  
In order for Module positions to be available for selection in the Module Manager they must be declared in the templateDetails.xml file for your template.  The <positions> element in this file contains sub-elements for each Module position that is supported by the template.
+
==Module Elements in templateDetails.xml==
  
For example, here is a typical <positions> element in the templateDetails.xml file for a typical template.
+
In the file, the sub-element <code><positions></code> along with its sub-elements <code><position></code> define the locations available for each Module position supported by the template. Here is a brief list of the commonly used names for the various module positions and how they are declared.
 
+
<pre>
<source lang="xml">
+
 
<positions>
 
<positions>
<position>left</position>
+
  <position>top</position>
<position>right</position>
+
  <position>left</position>
<position>top</position>
+
  <position>right</position>
<position>user1</position>
+
  <position>bottom</position>
<position>user2</position>
+
  <position>banner</position>
<position>user3</position>
+
  <position>syndicate</position>
<position>user4</position>
+
  <position>footer</position>
 +
  <position>user1</position>
 +
  <position>user2</position>
 +
  <position>user3</position>
 +
  <position>user4</position>
 +
  <position>debug</position>
 
</positions>
 
</positions>
</source>
+
</pre>
 +
 
 +
Although these are commonly used, it is up to the template developer to choose both a module position name and the accompanying display layout.
 +
 
 +
The addition of module positions, as displayed above, is implemented in between the <code><positions></code> and <code></positions></code> tags. In between those tags in the <code>templateDetails.xml</code> file, add the name of the module position in between a set of <code><position></code> and <code></position></code> tags.
  
 
You can add and define new Module positions and give them any name you like, but it is recommended that you support at least those shown in the example above.  This is so that some level of consistency is maintained when switching Templates or using multiple Templates on a single site.
 
You can add and define new Module positions and give them any name you like, but it is recommended that you support at least those shown in the example above.  This is so that some level of consistency is maintained when switching Templates or using multiple Templates on a single site.
  
<noinclude>[[Category:Beginners]]</noinclude>
+
==Use and Implementation==
<noinclude>[[Category:Modules]]</noinclude>
+
 
<noinclude>[[Category:Templates]]</noinclude>
+
A Joomla! template displays a set of modules added to a specific position using the <code><jdoc:include /></code> statement shown below:
<noinclude>[[Category:Topics]]</noinclude>
+
<pre>
 +
<jdoc:include type="modules" name="name of module position" style="xhtml" />
 +
</pre>
 +
 
 +
For further information about <code><jdoc:include /></code> code and how to use it, see [[jdoc statements]].
 +
 
 +
==See also==
 +
*[[Customising the way modules are displayed]]
 +
*[[Counting modules in a given module position]]
 +
*[[Counting modules in multiple module positions]]
 +
*[[Applying custom module chrome]]
 +
 
 +
<noinclude>[[Category:Beginners]][[Category:Modules]][[Category:Templates]][[Category:Topics]]</noinclude>[[Category:Tutorials]][[Category:Template Development]]

Latest revision as of 06:32, 30 September 2013

The templateDetails.xml file contains all the installation and core information for a template. In order for Module positions to be available for selection in the Module Manager, the positions must be declared in the templateDetails.xml file of the template.

Module Elements in templateDetails.xml

In the file, the sub-element <positions> along with its sub-elements <position> define the locations available for each Module position supported by the template. Here is a brief list of the commonly used names for the various module positions and how they are declared.

<positions>
  <position>top</position>
  <position>left</position>
  <position>right</position>		
  <position>bottom</position>
  <position>banner</position>
  <position>syndicate</position>
  <position>footer</position>
  <position>user1</position>
  <position>user2</position>
  <position>user3</position>
  <position>user4</position>
  <position>debug</position>
</positions>

Although these are commonly used, it is up to the template developer to choose both a module position name and the accompanying display layout.

The addition of module positions, as displayed above, is implemented in between the <positions> and </positions> tags. In between those tags in the templateDetails.xml file, add the name of the module position in between a set of <position> and </position> tags.

You can add and define new Module positions and give them any name you like, but it is recommended that you support at least those shown in the example above. This is so that some level of consistency is maintained when switching Templates or using multiple Templates on a single site.

Use and Implementation

A Joomla! template displays a set of modules added to a specific position using the <jdoc:include /> statement shown below:

<jdoc:include type="modules" name="name of module position" style="xhtml" />

For further information about <jdoc:include /> code and how to use it, see jdoc statements.

See also