Posted By

dburgess on 12/10/11


Tagged

pages page code only for home internal


Versions (?)

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


 / Published in: PHP
 

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

  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()) {
  5.  
  6. //This code will be executed on the home page
  7.  
  8. } else {
  9.  
  10. //This code will be executed on every page except the home page
  11.  
  12. }
  13. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: morktron on August 6, 2012

If you want to add html then this is also useful:

this is the front page

do something else
Posted By: morktron on August 6, 2012

Sorry looks like I can't put code in the comments!

You need to login to post a comment.