Highlighting a dynamic php page in the menu - have code
The project I am working on uses query strings to supply the pages like...
index.php?page=about
Normally nothing indicates what page in the menu is currently active, but on this project I would like to do this. (using red as an example)
PHP Code:
<?php
$request = $_SERVER['REQUEST_URI']; //set the variable $lasturl to the, well, last url.
if (strpos('domain.com/index.php?page=about',$request)) {
echo("<font color=\"red\"<b>About Us</b></font>");
}
else { echo("<a href=\"?page=about\" class=\"menu\">About Us</a>"); }
?>
The above worked fine I thought...until I went to just "'domain.com/index.php" and both menu options I setup with this as a test were highlighted. I am thinking something needs to be added to the $request var, but if the index page is accessed without any query strings I would like to not show anything highlighted until that actual page shows in the URL.
I am partially there until I discovered this issue, so hopefully there is a way I can accomplish this somehow. Thank you very much for any help on getting this resolved.