Joomla!
http://forum.joomla.org/

Templates FAQ - What are module switches? (or -1 -2 and -3)
http://forum.joomla.org/viewtopic.php?f=414&t=123351
Page 1 of 1

Author:  Jenny [ Sat Dec 16, 2006 10:15 pm ]
Post subject:  Templates FAQ - What are module switches? (or -1 -2 and -3)

What are module "switches" or those funny looking negative numbers in mosLoadModules statements?

There are three "switches" that you can use to change the way modules are displayed.

switch:  -1
Strips all surrounding code from the module.

switch: -2
Puts the module's title in a h3, and wraps the entire thing in a


switch: -3
Puts the module's title in a h3, and ads several layers of divs that can be used to apply CSS techniques with rounded corners


This is how you apply the switches:


switch:  -1
Strips all surrounding code from the module.


Code:
<?php mosLoadModules ( 'user1', -1 ); ?>

The outputted html code looks like this:

Code:
<div class="user1_inner">
<ul class="latestnews">
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=3&Itemid=9" class="latestnews">
Newsflash 2
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=4&Itemid=9" class="latestnews">
Newsflash 3
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=2&Itemid=9" class="latestnews">
Newsflash 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=9&Itemid=2" class="latestnews">
Example News Item 4
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=7&Itemid=2" class="latestnews">
Example News Item 2
</a>
</li>
</ul>
</div>


switch: -2
Puts the module's title in a h3, and wraps the entire thing in a


Code:
<?php mosLoadModules ( 'user1', -2 ); ?>


The outputted html code looks like this:

Code:
<div class="moduletable">
<h3>
Latest News
</h3>
<ul class="latestnews">
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=4&Itemid=9" class="latestnews">
Newsflash 3
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=2&Itemid=9" class="latestnews">
Newsflash 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=3&Itemid=9" class="latestnews">
Newsflash 2
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=6&Itemid=2" class="latestnews">
Example News Item 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=9&Itemid=2" class="latestnews">
Example News Item 4
</a>
</li>
</ul>
</div>


switch: -3
Puts the module's title in a h3, and ads several layers of divs that can be used to apply CSS techniques with rounded corners


Code:
<?php mosLoadModules ( 'user1', -3 ); ?>


The outputted code looks like this:

Code:
<div class="module">
<div>
<div>
<div>
<h3>
Latest News
</h3>
<ul class="latestnews">
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=4&Itemid=9" class="latestnews">
Newsflash 3
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=2&Itemid=9" class="latestnews">
Newsflash 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=3&Itemid=9" class="latestnews">
Newsflash 2
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=6&Itemid=2" class="latestnews">
Example News Item 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=9&Itemid=2" class="latestnews">
Example News Item 4
</a>
</li>
</ul>
</div>
</div>
</div>
</div>



If there is no switch at all:

Code:
<?php mosLoadModules ( 'user1'); ?>


The outputted code looks like this:

Code:
<table class="moduletable" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th valign="top">
Latest News
</th>
</tr>
<tr>
<td>
<ul class="latestnews">
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=4&Itemid=9" class="latestnews">
Newsflash 3
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=2&Itemid=9" class="latestnews">
Newsflash 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=3&Itemid=9" class="latestnews">
Newsflash 2
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=6&Itemid=2" class="latestnews">
Example News Item 1
</a>
</li>
<li class="latestnews">
<a href="http://localhost/projects/1112rc2/index.php?option=com_content&task=view&id=9&Itemid=2" class="latestnews">
Example News Item 4
</a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>



See the pictures to see how each looks. The default rhuk_solarflare_ii template was used to show the examples.

(Please note: This applies only to modules. You can't use switches on mosMainBody.)

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/