Click to See Complete Forum and Search --> : is $PHP_SELF equal to $page?


Tim158
05-29-2003, 05:23 AM
Can somebody please tell me how I can get this to work?
It should compare the active link with the button's link then display the button accordingly.

This file is 'included' in every page.

CODE:

function header ()
{
<div <?if ($PHP_SELF == $thisPage){echo "class=\"activeLink\"";} else { ?> class="button" onMouseOver="this.style.background='#FFFFFF'; this.style.border='1px dashed #000000'" onMouseOut="this.style.background='#CCCCFF'; this.style.border='1px solid #CCCCFF'"<?}?>>
Home
</div>
<!--Insert other buttons here-->
}

pyro
05-29-2003, 06:55 AM
Huh? What does $thisPage equal?

Tim158
05-29-2003, 07:03 AM
$thisPage = "index.php";

...or whatever page the button links to.

I know this button doesn't go anywhere; normally it has an anchor either side of "Home".

Even if you replace $thisPage with "index.php", $PHP_SELF doesn't seem to equal it when the file is index.php.

pyro
05-29-2003, 07:15 AM
That is because PHP self would return the path of the page. ie. /path/to/index.php or, if index.php is in the root directory, /index.php. Note the preceding slash.