I am trying to make my navigation to change color when selected. the class for selected is "current"
so I wrote this:
<ul class="<?php if(myfullpath() == "http://www.domain.com/first.php" || "http://www.domain.com/second.php"){echo "current";} else echo " "; ?>">
so if the url in the address bar is not first.php or second.php it should return false and echo " ", but for some odd reason this is returning true and posting class="current"> even if the url is posting http://www.domain.com/fourth.php.
JUST FYI here is the myfullpath function:
function myfullpath() { $s = empty($SERVER["HTTPS"]) ? '' : ($SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($SERVER["SERVER_PORT"] == "80") ? "" : (":".$SERVER["SERVER_PORT"]); return $protocol."://".$SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }
thanks for your help.