Difference between revisions of "Module chrome"

From Joomla! Documentation

Line 16: Line 16:
 
! width="204" | Appearance
 
! width="204" | Appearance
 
|-
 
|-
| '''rounded'''  
+
|
(default for menus on milkyway)
+
'''rounded''' (default for menus on milkyway)
| <source lang="html4strict">
+
|
  <div class="module_menu">
+
<source lang="html4strict">
 +
<div class="module_menu">
 +
  <div>
 
     <div>
 
     <div>
 
       <div>
 
       <div>
         <div>
+
         <h3>Main Menu</h3>
          <h3>Main Menu</h3>
+
        <ul class="menu">
          <ul class="menu">
+
          <li><!-- various menu items --></li>
            <!-- various menu items -->
+
         </ul>
          </ul>
 
         </div>
 
 
       </div>
 
       </div>
 
     </div>
 
     </div>
 
   </div>
 
   </div>
  </source>
+
</div>
|[[Image:Module_chrome_rounded.png]]
+
</source>
 +
|
 +
[[Image:Module_chrome_rounded.png]]
 
|-
 
|-
| '''none'''
+
|
| <source lang="html4strict">
+
'''none'''
 +
|
 +
<source lang="html4strict">
 +
<ul class="menu">
 +
  <li><!-- various menu items --></li>
 +
</ul>
 +
</source>
 +
|
 +
[[Image:Module_chrome_none.png]]
 +
|-
 +
|
 +
'''table'''
 +
|
 +
<source lang="html4strict">
 +
<table cellpadding="0" cellspacing="0" class="moduletable_menu">
 +
  <tr>
 +
    <th valign="top">Main Menu</th>
 +
  </tr>
 +
  <tr>
 +
    <td>
 +
      <ul class="menu">
 +
        <li><!-- various menu items --></li>
 +
      </ul>
 +
    </td>
 +
  </tr>
 +
</table>
 +
</source>
 +
|
 +
[[Image:Module_chrome_table.png]]
 +
|-
 +
|
 +
'''horz'''
 +
|
 +
<source lang="html4strict">
 +
<table cellspacing="1" cellpadding="0" border="0" width="100%">
 +
  <tr>
 +
    <td valign="top">
 +
      <table cellpadding="0" cellspacing="0" class="moduletable_menu">
 +
        <tr>
 +
          <th valign="top">Main Menu</th>
 +
        </tr>
 +
        <tr>
 +
          <td>
 +
            <ul class="menu">
 +
              <li><!-- various menu items --></li>
 +
            </ul>
 +
          </td>
 +
        </tr>
 +
      </table>
 +
    </td>
 +
  </tr>
 +
</table>
 +
</source>
 +
|
 +
[[Image:Module_chrome_horz.png]]
 +
|-
 +
|
 +
'''xhtml'''
 +
|
 +
<source lang="html4strict">
 +
<div class="moduletable_menu">
 +
  <h3>Main Menu</h3>
 
   <ul class="menu">
 
   <ul class="menu">
     <!-- various menu items -->
+
     <li><!-- various menu items --></li>
</ul>
+
  </ul>
  </source>
+
</div>
|[[Image:Module_chrome_none.png]]
+
</source>
 +
|
 +
[[Image:Module_chrome_xhtml.png]]
 
|}
 
|}
  

Revision as of 15:44, 18 January 2008

What is Module chrome?[edit]

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 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 is used the index.php file of a 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!

Style Output Appearance

rounded (default for menus on milkyway)

<div class="module_menu">
  <div>
    <div>
      <div>
        <h3>Main Menu</h3>
        <ul class="menu">
          <li><!-- various menu items --></li>
        </ul>
      </div>
    </div>
  </div>
</div>

Module chrome rounded.png

none

<ul class="menu">
  <li><!-- various menu items --></li>
</ul>

Module chrome none.png

table

<table cellpadding="0" cellspacing="0" class="moduletable_menu">
  <tr>
    <th valign="top">Main Menu</th>
  </tr>
  <tr>
    <td>
      <ul class="menu">
        <li><!-- various menu items --></li>
      </ul>
    </td>
  </tr>
</table>

Module chrome table.png

horz

<table cellspacing="1" cellpadding="0" border="0" width="100%">
  <tr>
    <td valign="top">
      <table cellpadding="0" cellspacing="0" class="moduletable_menu">
        <tr>
          <th valign="top">Main Menu</th>
        </tr>
        <tr>
          <td>
            <ul class="menu">
              <li><!-- various menu items --></li>
            </ul>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Module chrome horz.png

xhtml

<div class="moduletable_menu">
  <h3>Main Menu</h3>
  <ul class="menu">
    <li><!-- various menu items --></li>
  </ul>
</div>

Module chrome xhtml.png