Show modules on all pages except front page |
|
|
It’s very common to want to put modules on all pages except the front page. This recipe allows you to target the front page (or any given page) and either exclude a module from that page or include it on that page. This assumes that you are using the standard “frontpage” component as the first menu item on your main menu. If you have changed to a different component for the first page on your site, then use the MetaMod Debug mode to find the right combination of $Itemid, $option and $view to identify the page and therefore not show the module on it. Place module 101 on all pages except the front page: if (! ($view == "frontpage" && $option == "com_content" ) ) return 101; Place module 101 only on the front page: if ( $view == "frontpage" && $option == "com_content" ) return 101; There’s also an official Joomla way to identify the front page, by comparing the “active” menu to the “default” menu (i.e. one chosen for the front page). However this does not work in all cases (e.g. sometimes it activates when a form is “posted” to index.php), so the rules above are recommended. Place module 101 only on the front page: $menu = & JSite::getMenu(); if ($menu->getActive() == $menu->getDefault()) return 101; |


