Joomla - Execute some code on home page and other code on all other pages

/ Published in: PHP
Save to your folder(s)

This will let you execute certain scripts on the home page and other scripts on the other pages of the site.

Copy this code and paste it in your HTML
  1. <?php
  2. //This will detect the Home Page of Joomla and perfom whatever code you tell it to
  3. $menu = & JSite::getMenu();
  4. if ($menu->getActive() == $menu->getDefault()) {
  6. //This code will be executed on the home page
  8. } else {
  10. //This code will be executed on every page except the home page
  12. }
  13. ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.