Im trying to figure out how to I would display a tab menu that displays a tab on the menu item of the current page, but Im not sure how to find what the current page being shown is. Would I use something like this?
$current = basename(dirname(FILE))
or either one of these,?
$SERVER['REQUEST_URI']
$SERVER['PHP_SELF']
I was trying to make a switch case for each page, that will finds the page being shown, and passes $currentpage = to the page shown, and in list menu would show the 'current' css class that shows the tab.
Heres what I mean:
switch (basename($_SERVER['REQUEST_URI'])) {
case 'index.html':
$cur = 'current';
break;
case 'otherpage.html':
$cur = 'current';
break;
default:
$cur = 'current';
break;
}
// and the menu would be something like this
echo '<ul>
<li class="$cur"><a href="/index.html">Home</a></li>
<li class="$cur"><a href="/other_page.php">Other Page</a></li>
</ul>
';
So far I can only get either all the menu links or none of the links to show the tab image. And not individually when on the corresponding pages to the links.
Do I need to create a different variable for every page, or
might there possibly be an easier way to go about doing this all together, because I feel there is probably a better, or more efficient way to do something so basic?
Thanks