identifying the page

Hi - I have a php script that generates a header on the top of several pages. I’m looking for the right way to code:

  1. If this page is index.php, display X
  2. If this page is not index.php, display X

Any help would be appreciated!

Thanks
-Kal

[php]
$farr = Explode(’/’, $_SERVER[“SCRIPT_NAME”]); $file = $farr[count($farr) - 1];

if($file==‘index.php’)
{
// action 1
}
else
{
// action 2
}

[/php]

or
[php]
$file = pathinfo($_SERVER[‘PHP_SELF’]);
if($file[‘basename’] == ‘index.php’)
{
// action 1
}
else
{
// action 2
}
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service