Create beautiful Joomla websites with a flexible layout from iJoomla.com
Recently I had to add some PHP code to the template of a Joomla site I run, but I wanted that code to run on the homepage only. Considering the fact that I'm using an SEF component on the site, it was tricky, but here's the line of PHP code I was able to do it with:
$pge = $_SERVER['QUERY_STRING']; if ($pge == "/index.php"||$pge == "") {
//do stuff
}
Create beautiful Joomla websites with a flexible layout from iJoomla.com
8 Comments
Top man, that's a simple enough line… all I gotta do now is think of stuff to do now that I know it's do-able.
Had to Modify your code to work for me as below
Your Page Title ";
}
?>
Your Page Title ";
} ?>
Your Page Title ";
}
?>
$pge = $_SERVER['QUERY_STRING']; if ($pge == "/index.php"||$pge == ""||$pge == "option=com_frontpage&Itemid=1") {
//do stuff
echo " Your Page Title ";
}
thank you very very much! that literally solved my provlem with adding a special flash script just to the startpage.
you are genius! thanks again!
why not
if ( JURI::base() == JURI::current() )
{
//do stuff
}
That is great. but it doesnt seem to work with URL rewrites