Trying to get my PHP navigation bar to work. I am trying to echo the page where the user is on with the attached class of active if the page is current.
Here is my code
Not tested:
"Home",
"contact.php" => "Contact Us",
"services.php" => "services",
"employees.php" => "Employees",
"dashboard.php" => "Dashboard");
$uri = explode("/", stripslashes($_SERVER['REQUEST_URI']));
foreach ($pages as $url => $label) {
echo '- '.$label.'
';
}
?>
Note: it is a best practice to put your other page files in the root next to yout index.php