Keyword

Just a Tip... Showing and Hiding Module Positions Based on Component or Frontpage

  • Heather
  • Heather's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 3 months ago #78190 by Heather
I have long since starting with Joomla had a bit of a "thing" against the standard Jooma look for the home page of a site, and figured out that I could do a quick conditional on my template index.php that would show a different layout for the frontpage only:<?php$menu = & JSite::getMenu();if ($menu->getActive() == $menu->getDefault()) {?>      HOME PAGE MODULE/CONTENT POSITIONS            <?   }   else {?>      REGULAR MODULE/CONTENT POSITIONS<?   } ?>
I was playing today with a new project I am working on, and realized that I now have found a reason to do the same thing with a component every now and again.The code is just a bit different, so I thought I'd post it here, since there may be some times when you want to hide module positions based on whether you are in K2 (or any other component - I'm using it for JomSocial on a K2 site) or not.<?phpif ($_GET["option"]=="com_COMNAME") {?>                              SPECIAL CASE MODULE/CONTENT POSITIONS            <?   }   else {?>      REGULAR MODULE/CONTENT POSITIONS<?   } ?> 
*smiles*

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum