Actions

Difference between revisions of "What are module switches?"

From Joomla! Documentation

(New page: This is how you apply the switches: ; <nowiki>switch: -1</nowiki> : Strips all surrounding code from the module. <source lang="php"> <?php mosLoadModules ( 'user1', -1 ); ?> </source> ...)
 
m (clean up categories with <noinclude> tags)
 
(One intermediate revision by one user not shown)
Line 189: Line 189:
 
                 switch  -1:  $stylle = 'raw';
 
                 switch  -1:  $stylle = 'raw';
 
switch  0 :$style = 'table';
 
switch  0 :$style = 'table';
 +
 +
<noinclude>[[Category:FAQ]]
 +
[[Category:Installation FAQ]]
 +
[[Category:Upgrading and Migrating FAQ]]
 +
[[Category:Version 1.5 FAQ]]</noinclude>

Latest revision as of 16:19, 1 September 2012

This is how you apply the switches:

switch: -1
Strips all surrounding code from the module.
 <?php mosLoadModules ( 'user1', -1 ); ?>

The outputted html code looks like this:

<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
 <?php mosLoadModules ( 'user1', -2 ); ?>

The outputted html code looks like this:

 <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
 <?php mosLoadModules ( 'user1', -3 ); ?>

The outputted code looks like this:

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

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

The outputted code looks like this:

 <table class="moduletable" border="0" 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>
 </div>

In Joomla! 1.5 each switch has a style associated with it.

switch -3: $style = 'rounded';

               switch -2:  $style = 'xhtml
               switch  -1:  $stylle = 'raw';

switch 0 :$style = 'table';