Hi I'm using PHP for my Navigation Menu,
My navbar is in a file named "home.php" looks like this:
<ul class="nav navbar-nav navbar-right">
<li><a href="?page=home">Home</a></li>
<li><a href="?page=about">About</a></li>
<li><a href="?page=services">Services</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="?page=service2">Service 2</a></li>
</ul>
</ul>
Then in my index.php:
$page = $_GET['page'];
if (!isset($page)) {
include('home.php');
}
if ($page == "home") {
include('home.php');
}
if ($page == "about") {
include('about.php');
}
if ($page == "services") {
include('services.php');
}
if ($page == "service2") {
include('service2.php');
}
It all works how I want it to except for one thing; I'd like to add;
<li class="active">
To the page that is currently being viewed. How can I do this? Thank you in advance.