Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Tips and Tricks arrow #35 - Collapsible Template Positions

Print E-mail

#35 - Joomla Templates - Collapsible Template Positions

Often when designing a Joomla website, you find that there are certain pages where you require certain modules, whilst other pages where these shouldn't be visible. This is easily done via Joomla's functionality of assigning modules to menu item links.

However, this brings about a new problem. The position in the template. How do you create a template which can collapse a module position which is currently not being used? This can be done by counting the number of modules currently assigned to this position by using a few Joomla function calls mosCountModules. An example of this is found below.

<div id="usertoolswrap">
    <div id="usertools">
    <?php if (mosCountModules('user4')) {?>
        <div id="user4">
            <?php mosLoadModules ( 'user4', -1 ); ?>
        </div>
   <?php } ?>
   </div>
 </div>

As we can see, in the code above the user4 position is only rendered when there are modules assigned to position user4. The count modules function allows us only to render the position when modules are assigned to it, and collapses the template position if there are no modules assigned.

Comments
Add NewSearchRSS
asdf - asdf IP:219.12.52.80 | 2008-06-05 11:57:59
asdfasdf
Write comment
Name:
Title:
Security Image
 

Subscribe to our feed


RSS Feed

DART Creations - Joomla Tutorials, Tips and Tricks and more...

Joomla Tips

DART Creations Joomla Tips, Tricks, tutorials and general Joomla help

Sponsors

Login Form






Lost Password?
No account yet? Register