Modules are small building blocks/elements that make up your site. They usage is generally to display small snippets of information, whether than be latest content items or a slideshow of sorts.
A module hilite or module class suffix are the terms giving to the ability to style your modules individually and independently. A Joomla template has stylesheets/css files in which a part of these stylesheets are devoted to the layout and styling on modules. This styling applies to all modules using that template. However, a hilite is an addition to the general module styling of a template to make it unique. This could range from just changing the colour of the links in the module to applying custom background images, colours, font-styles.
The uses of module hilites go beyond the design level with colours, images and other related elements. The structure or layout can also be controlled to the desired effect. The best example for this is a slideshow, such as Rokslideshow from RocketWerx. You may wish for the module to have no margins, paddings and borders so it sits flush in its position to a great effect. However, what if the template has margins and paddings set for its modules?; the hilite will overrite this if set in the stylesheets.
The code of the module or the HTML output of the module is not always the same. This is dictated by settings in the template's index.php. There are 5 settings to choose from. A brief outline of the different module settings can be seen below with top as our example:
<?php mosLoadModules('top', >0); ?>Style 0 displays modules in a column within the position. It is best not to use this option where possible as it limits styling. The HTML output of this setting can be seen below:
<table cellspacing="0" cellpadding="0" class="moduletable"> <tbody> <tr> <th valign="top">Module Header</th> </tr> <tr> <td>Module Output</td> </tr> </tbody> </table>If we had applied the module class suffix of -hilite1, this would be the HTML output.
<table cellspacing="0" cellpadding="0" class="moduletable-hilite1"> <tbody> <tr> <th valign="top">Module Header</th> </tr> <tr> <td>Module Output</td> </tr> </tbody> </table>
<?php mosLoadModules('top', 1); ?>
The HTML output of 2 modules with this setting are below:
<table width="100%" cellspacing="1" cellpadding="0" border="0"> <tbody> <tr> <td valign="top"> <table cellspacing="0" cellpadding="0" class="moduletable"> <tbody> <tr> <th valign="top">Module Header</th> </tr> <tr> <td>Module Output</td> </tr> </tbody> </table> </td> <td valign="top"> <table cellspacing="0" cellpadding="0" class="moduletable"> <tbody> <tr> <th valign="top">Module Header</th> </tr> <tr> <td>Module Output</td> </tr> </tbody> </table> </td> </tr> </tbody> </table>If we had applied the module class suffix of -hilite1, this would be the HTML output.
<table width="100%" cellspacing="1" cellpadding="0" border="0"> <tbody> <tr> <td valign="top"> <table cellspacing="0" cellpadding="0" class="moduletable-hilite1"> <tbody> <tr> <th valign="top">Module Header</th> </tr> <tr> <td>Module Output</td> </tr> </tbody> </table> </td> <td valign="top"> <table cellspacing="0" cellpadding="0" class="moduletable-hilite1"> <tbody> <tr> <th valign="top">Module Header</th> </tr> <tr> <td>Module Output</td> </tr> </tbody> </table> </td> </tr> </tbody> </table>
<?php mosLoadModules('top', -1); ?>
Style -1 displays modules in their raw output form, therefore, no headers.. The HTML output of this setting can be seen below:
Module OutputHilites do not affect these module types.
<?php mosLoadModules('top', -2); ?>
Style -2 encloses modules in a <div> and allows for CSS styling. This module settings is most frequently used due to its versatility. The HTML output of this setting can be seen below:
<div class="moduletable"> <h3>Module Header</h3> Module Output </div>If we had applied the module class suffix of -hilite1, this would be the HTML output.
<div class="moduletable-hilite1"> <h3>Module Header</h3> Module Output </div>
<?php mosLoadModules('top', -3); ?>
Style -3 type modules allow for expandable rounded corners. The process changes moduletable to module with the addition of 3 extra <div> tags excluding closing tags. The HTML output of this setting can be seen below:
<div class="module"> <div><div><div> <h3>Module Header</h3> Module Output </div></div></div> </div>If we had applied the module class suffix of -hilite1, this would be the HTML output.
<div class="module-hilite1"> <div><div><div> <h3>Module Header</h3> Module Output </div></div></div> </div>
The module class suffixes are loaded from the CSS/stylesheet files. Depending on your how extensive your module class suffixes are and their purposes, determines which CSS file you shall place them in. If you are editing the structure of the content page such as removing the margins for a slideshow, place the suffix into template_css.css or similar file such as default.css. However, if it is a suffix based on style such as content background colour, then choose style.css or similar file. If it is a mixture, divide them into both files, the structural styles in template_css.css and colours in style.css. Choosing which CSS file is not important in terms of the output of the suffix but is more efficient organisation of your stylesheets.
What are the prefixes that make the class suffix work? Probably the most important part of this tutorial is what you need to insert into your style sheets. From the main section prior, we are now aware that there are 5 module styles to choose from which produce different HTML outputs, therefore, we have different CSS code that we need to use. However, types 0 and 1 use the same style code and type-1 cannot have additional styling. Therefore, we will focus on types 0 and 1 as a single section with -2 and -3 as additional pieces.
table.moduletable-hilite {From earlier, the HTML output that concerns us is <table cellpadding="0" cellspacing="0" class="moduletable"> . The opening tag is table which initiates the statement in the css table. The class changes to . (dot) in the style sheets after table. After the dot, we have moduletable, which was between the " " tags in the HTML. Any code between those tags are what follow the dot.
div.moduletable-hilite {From earlier, the HTML output that concerns us is <div class="moduletable"> . The opening tag is div which initiates the statement in the css div. The class changes to . (dot) in the style sheets after div. After the dot, we have moduletable, which was between the " " tags in the HTML. Any code between those tags are what follow the dot.
div.module-hilite {} div.module-hilite div {} div.module-hilite div div{} div.module-hilite div div div{}From earlier, the HTML output that concerns us is <div class="module"><div><div><div> . The opening tag is div which initiates the statement in the css div. The class changes to . (dot) in the style sheets after div. After the dot, we have module, which was between the " " tags in the HTML. Any code between those tags are what follow the dot. We must remember to take into account the extra 3 <div>s. Therefore, we need to apply additional styling for each extra <div> which is a subsidiary of the main reference.
Let us show a few examples from the snippets above and describe the effects.
table.moduletable-hilite1{ background:#000; color:#fc0; font-size:15px; font-family:Comic Sans MS; border:5px solid #fc0; text-align:justify; }
div.moduletable-hilite1{ background:#000; color:#fc0; font-size:15px; font-family:Comic Sans MS; border:5px solid #fc0; text-align:justify; }
div.module-hilite1{ background:#000; color:#fc0; font-size:15px; font-family:Comic Sans MS; border:5px solid #fc0; text-align:justify; }
From the snippet above, I have concentrated on styling so I would place that in my template's style.css file. The following lists describes the effect/purpose of each line
Now to use a structural hilite example instead of just styling. In this situation, it would be best to place the CSS in the template_css.css file
table.moduletable-hilite1{ margin:10px; padding:10px; }
div.moduletable-hilite1{ margin:10px; padding:10px; }
div.module-hilite1{ margin:10px; padding:10px; }
In this situation, we are applying a margin and padding of 10px. The margin is the distance between the module and the position. For example, margin-top:10px;" will move the module 10 pixels from the top of the module position such as advert1. Padding is slightly different, this is the distance/space between the module boundary and the output of the module or content if you prefer.
In another scenario in which we have a slideshow module which we want to be flush, we can apply a module hilite remove any template margins or padding that are generating the undesired spaces. Apply the module class suffix -flush. This does not exist in the template but adding the non-existent suffix removes any styling from the module, creating the same effect. These are just examples in which you can expand upon.
In most circumstances, you will wish to apply different styling to your module headings to your module content. This requires some additional CSS in the stylesheets to accomplish.
The following examples are based on styling the headers, in which it would be best to insert the module class suffixes into the style.css type file.
table.moduletable-hilite1 th{ color:#fc0; }
div.moduletable-hilite1 h3{ color:#fc0; }
div.module-hilite1 h3{ color:#fc0; }
The main hilite statements, such as div.moduletable-hilite1 are followed by a additionally tag, separated with a space. For types -2/-3, h3 is the tag that we insert which refers to Heading3 or <h3>...</h3> in HTML. The tabled module, table.moduletable-hilite1 uses th as its extra tag which refers to Table Heading or <th>...</th> in HTML. This method allows us to focus on a particular part of the module, in this case the Headings.
The code we insert between the {} tags was color:#fc0;. This makes all text gold in the module,excluding links. These are just examples in which you can expand upon.
As observed before, we can control the layout with the CSS. We will place the structural styling in the template_css.css file for organisational purposes. A few examples are soon below:
table.moduletable-hilite1 th{ padding-left:10px; font-weight:bold; }
div.moduletable-hilite1 h3{ padding-left:10px; font-weight:bold; }
div.module-hilite1 h3{ padding-left:10px; font-weight:bold; }
The code show above moves the Heading text 10px from the left of the module, as denoted by padding-left:10px;. That could be useful if you are using an image in your Module Header, such as an icon. The font-weight:bold; reference makes the Heading bold. These are just examples in which you can expand upon.
The same techniques can be applied to all HTML elements which are a subsidiary of the module itself, not just the Headings. These could range from lists, links or images as well as many others. The limitations are only by what you wish to use in the modules. A short example for links
table.moduletable-hilite1 a{ color:#c00; }
div.moduletable-hilite1 a{ color:#c00; }
div.module-hilite1 a{ color:#c00; }
Therefore, for this example, all links will have the colour red.
Stretchable rounded corners can be created when you use type-3/rounded for your Modules. This is because Joomla process the code to output 3 extra <div&;gt tag groups so we can style each layer to produce the rounded box effect. This is seen in the HTML output below
<div class="module-hilite1"> <div><div><div> <h3>Module Header</h3> Module Output </div></div></div> </div>
Before we begin to construct the module in the stylesheets/css, we need to create the background images that are going to be our rounded corners. This is best done in Fireworks. The following is a quick guide to creating rounded corners in Fireworks:
Now that you have created or download the images, you need to upload them to your website. Follow the instructions below
We are not at the point where we can integrate the Rounded Corners into our stylesheets as module class hilites. We insert the following into style.css. We are using 4 images, box-br.png, box-bl.png, box-tr.png & box-tl.png. Therefore, all our code will be based around those images so if you are using different names, change the references to fit your situation.
div.module-hilite1 { background: #333 url(../images/box-br.png) 100% 100% no-repeat; } div.module-hilite1 div { background: url(../images/box-bl.png) 0 100% no-repeat; } div.module-hilite1 div div{ background: url(../images/box-tr.png) 100% 0 no-repeat; } div.module-hilite1 div div div{ background: url(../images/box-tl.png) 0 0 no-repeat; }
The first snippet, div.module-hilite1 { is the main module block reference as seen in prior sections. The background is split into sections:
The next section of code, div.module-hilite1 div{ is the block that controls the following div layer in the module.
The third reference, div.module-hilite1 div div{ is the block that controls the following div layer in the module.
The final statement, div.module-hilite1 div div div{ completes the div layers which creates the rounded corner.
We have everything now setup so we can apply the module class suffix to our module in the Joomla Administrator, this is a straight forward procedure which is outlined in the following guide:
http://www.yoursite.comYou will come across the login panel shown below. Enter your administrative username and password which were created when you install Joomla!
Modules -> Site Modules