Joomla! 1.5 module chrome offers web designers a flexible way to manipulate the output of modules. The built in chrome functions can be found in templates/system/html/modules.php. These functions can be accessed with the tag in your template. For example, the tag has the style "xhtml", so Joomla! will look for the function modChrome_xhtml(), and use this to generate the output for the module.
You can use these functions as a guide, and make your own chrome. To do this, create a file in your template at templates/YOUR_TEMPLATE_NAME/html/modules.php. Any functions you add to this will be available to use in your template. Just make sure you follow the examples for the naming convention, and to know the variables you have available.
Here's a module chrome I made to give me more flexible module style options.
Here's the tag I use:
<doc:include type="modules" name="right" style="default" />
This means that all the modules in the "right" position will refer to the "default" function in my custom module chrome. And here's the corresponding function, with an assortment of ideas to extend the styling possibilities...
function modChrome_default($module, &$params, &$attribs)
{
if (!empty ($module->content)) :
static $count = 1;
$class = $params->get('moduleclass_sfx',null);
$name = JFilterOutput::stringURLSafe($module->title);
$class .= ' count_' . $count;?>
<div class="module <?php echo $class; ?> <?php echo $module->module;?> <?php echo $name;?>">
<?php if ($module->showtitle != 0) : ?>
<h3><?php echo $module->title; ?></h3>
<?php endif; ?>
<div class="inner">
<?php echo $module->content; ?>
</div>
</div>
<?php
$count++;
endif;
}
If you like the site, please let me know in the form of cold hard cash!
0 Comments