In bootstrap 3 we have this <li>
class set to active in order to display the current page highlighted on the navbar
<li class="active">
<a href="linkaddress.html">Link</a>
</li>
the problem is when you are including the menu via include includes/header.php;
on all your pages. i cant figure out how to put together a switch statement on the $actual_link
and bring back some sort of call to insert the class active in the right place. this my so far attempt and im honestly stuck because i feel there is a better way. how can i can i put the li
class to active
with this switch
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$HTTPHost = $_SERVER[HTTP_HOST];
switch($actual_link)
{
case "http://{$HTTPHost}/index.php" ||
"http://{$_SERVER[HTTP_HOST]}/admin.php?edit_home":
//setToActive
break;
case "http://{$HTTPHost}/warrants.php" ||
"http://{$_SERVER[HTTP_HOST]}/admin.php?edit_warrants":
//setToActive
break;
case "http://{$HTTPHost}/faq.php" ||
"http://{$_SERVER[HTTP_HOST]}/admin.php?edit_faq":
//setToActive
break;
case "http://{$HTTPHost}/aboutus.php" ||
"http://{$_SERVER[HTTP_HOST]}/admin.php?edit_aboutus":
//setToActive
break;
}
?>