At the Joomla! help site, there is a great article explaining the various functions to be used in a Joomla! template. It gives an explanation of the parameters involved in the mosLoadModules function, which often cause confusion for new template developers. You can either read that article, or if you don't feel like leaving this page, you can continue reading this article, which will explain the same concepts.
Here is the basic syntax of a mosLoadModules function call:
mosLoadModules( $position_name [, $style] )
$position_name
This parameter is pretty self-explanatory. It tells Joomla! where to display your modules.
$style
This is the parameter that causes some confusion. While $position_name tells Joomla! where to position a set of modules, $style tells Joomla! how to render the modules at $position_name. This parameter is optional. If you do not put a value for $style, it will default to $style=0.
There are 5 possible values for $style: 0, 1, -1, -2, -3. Below is an explanation of each value.
$style = 0
As I mentioned, this is the default value for $style. I personally never use this value because it renders each module in a table, and I don't like tables.
Here is how the code is rendered using $style=0.
$style = 1
This is another value that I personally never use for the same reason as mentioned for $style=0. This $style renders each individual module the same as $style=0, but it wraps the modules in another table and displays them horizontally for that position.
Here is how the code is rendered using $style=1.
NOTE: Copied directly from Joomla! help site article
|
$style = -1
Now we're getting to the good stuff. This $style tells Joomla! to just display the raw ouput of the module without the module's title. This can be very useful for displaying things like horizontal menu bars, because you do not need a title, and you probably want to handle the HTML around your menu in your template.
Here is how the code is rendered using $style=-1.
NOTE: Copied directly from Joomla! help site article
Module 1 OutputModule 2 OutputModule 3 Output
Notice here that there are 3 modules in this module position: "Module 1 Output", "Module 2 Output", and "Module 3 Ouput". Notice also that there is no space between "Output" and "Module" where the modules touch each other. That is because Joomla! does not do anything but place the raw output from each module.
$style = -2
When designing a template, this is perhaps the module position $style that I use most often. It renders modules the way modules should be rendered, within a DIV block with the title set apart by the H3 tag. This is the best solution for creating a template with proper modern XHTML/CSS techniques.
Here is how the code is rendered using $style=-2.
NOTE: Copied directly from Joomla! help site article
Module Title
Module output$style = -3
This $style is good for performing some CSS styling tricks with your template. For example, if you want to display your modules with rounded corners, you could use this $style along with some CSS. It is basically the same as $style=-2 but it adds 3 "padding" DIV's around the output to enable designers to perform their CSS magic.
Here is how the code is rendered using $style=-3.
NOTE: Copied directly from Joomla! help site article
Module Title
Module outputWhat does it all mean?
Joomla! is a flexible system, and it provides several options for designers to render modules. With the addition of CSS, the options are virtually limitless.