Module chrome allows template designers to have a certain amount of control over the way the output from a Module is displayed in their template. Essentially, it consists of a small amount of predefined HTML which is inserted before, after, or around the output from each module, and which can then be styled using CSS. Module chrome is commonly used to provide borders around modules, especially with rounded corners, but it can be used for much more than that.

+

</includeonly>

−

+

{{Chunk:Module chrome}}

−

Module chrome is determined by using the '<tt>style</tt>' attribute in the statement calling the module. For example, the following statement may be used in the <tt>index.php</tt> file of a template to insert the Modules in the '<tt>user1</tt>' position and apply the '<tt>custom</tt>' Module chrome:

+

−

<source lang="php">

+

−

<jdoc:include type="modules" name="user1" style="custom" />

+

−

</source>

+

−

It can be seen that the same Module chrome is applied to every Module in that position - in other words, if you want to have two Modules in a column, but want them to have different Module chrome, then they would need to be set up as two different 'positions' (e.g. '<tt>user1</tt>' and '<tt>user2</tt>').

+

−

+

−

The standard Joomla! 1.5 package includes six default Module chrome styles. However, the flexibility of the template system means that you are not limited to these styles - it's very easy to create as many new styles as you want!

+

Note that this example includes class additions because the examples are taken using mod_mainmenu. The suffix "_menu" to the div class and the "menu" class on the ul tag are not present with other modules.

Note that this example includes class additions because the examples are taken using mod_mainmenu. The suffix "_menu" to the div class and the "menu" class on the ul tag are not present with other modules.

{| style="width:100%" class="wikitable"

{| style="width:100%" class="wikitable"

−

|+ '''Comparison of the Joomla! 1.5 standard Module chromes'''

+

|+ '''Comparison of the Joomla! 1.5/1.6 standard Module chromes'''

!Style

!Style

!Output

!Output

Line 123:

Line 116:

<noinclude>

<noinclude>

[[Category:Advanced|Chrome]]

[[Category:Advanced|Chrome]]

−

[[Category:Modules]]

+

[[Category:Module Development]]

−

[[Category:Templates]]

+

[[Category:Template Development]]

−

[[Category:Topics]]

+

[[Category:CSS]]

−

[[Category:Template FAQ]]</noinclude>

+

[[Category:Glossary]]

+

</noinclude>

Revision as of 20:23, 22 June 2013

<translate> Module chrome allows template designers to have a certain amount of control over the way the output from a Module is displayed in their template. Essentially, it consists of a small amount of predefined HTML which is inserted before, after, or around the output from each module, and which can then be styled using CSS. Module chrome is commonly used to provide borders around modules, especially with rounded corners, but it can be used for much more than that.

Module chrome is determined by using the 'style' attribute in the statement calling the module. For example, the following statement may be used in the index.php file of the currently assigned as main template to insert the Modules in the 'user1' position and apply the 'custom' Module chrome:

<jdoc:include type="modules" name="user1" style="custom"/>

It can be seen that the same Module chrome is applied to every Module in that position - in other words, if you want to have two Modules in a column, but want them to have different Module chrome, then they would need to be set up as two different 'positions' (e.g. 'user1' and 'user2').

The standard Joomla! 1.5+ package includes six default Module chrome styles. However, the flexibility of the template system means that you are not limited to these styles - it's very easy to create as many new styles as you want!</translate>

Note that this example includes class additions because the examples are taken using mod_mainmenu. The suffix "_menu" to the div class and the "menu" class on the ul tag are not present with other modules.

Note that the Module chrome doesn't necessarily change the appearance all that much - this depends on the CSS used in the template. For example, the 'none' and 'horz' chromes look very similar, although the underlying HTML code is very different.