Templates FAQ - What are module switches? (or -1 -2 and -3)

This is the archive off all FAQ related threads.
Locked
User avatar
Jenny
Joomla! Champion
Joomla! Champion
Posts: 6238
Joined: Sun Aug 21, 2005 2:25 pm
Contact:

Templates FAQ - What are module switches? (or -1 -2 and -3)

Post by Jenny » Sat Dec 16, 2006 10:15 pm

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: Select all

<?php mosLoadModules ( 'user1', -1 ); ?>
The outputted html code looks like this:

Code: Select all

<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: Select all

<?php mosLoadModules ( 'user1', -2 ); ?>
The outputted html code looks like this:

Code: Select all

<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: Select all

<?php mosLoadModules ( 'user1', -3 ); ?>
The outputted code looks like this:

Code: Select all

<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: Select all

<?php mosLoadModules ( 'user1'); ?>
The outputted code looks like this:

Code: Select all

<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.)
You do not have the required permissions to view the files attached to this post.
Last edited by Jenny on Tue May 01, 2007 4:46 pm, edited 1 time in total.
Co-author of the Official Joomla! Book http://officialjoomlabook.com
Marpo Multimedia http://marpomultimedia.com

Locked

Return to “FAQ Archive”