Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Tips and Tricks arrow #20 - Show / Hide a template position based on component displayed

Print E-mail

#20 - Show / Hide a template position based on component displayed 

Recently we were using a custom module position to load a slideshow module permanetly in the main body of a site. However as part of the site we wanted to use another component. The second component did not fit comfortably with the previous slideshow module. Therefore we wanted a way of hiding the slideshow module based on whether the 2nd component was being displayed or not.

The way to do this is to slightly hack the template (index.php). Basically there exists a global variable $option which determines which component is being displayed if any.

The hack is therefore the following:

    <?php
                    global $option;
                    if ($option!='com_xxxx')

                   {
                        mosLoadModules ( 'position');
                      }
              ?>

change to $option=='com_xxxx' to show only when a component is displayed

 where com_xxxx is the component you want to base your show/hide code on.

The above will hide the position module when the com_xxxx component is displayed.

Comments
Add NewSearchRSS
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

Buy us a beer!

Lots of time and effort goes into creating and maintaining this site. If we've helped you, consider buying a beer. It will inspire us to keep on giving! Thanks! (€3)






Cheers ;)