Page Source:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Navigation Test</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php include('links.php'); ?>
</body>
</html>
PHP Link Source:
<?php
//Define Variables
$currPage = $_SERVER['SCRIPT_NAME'];
$nl = "\n";
//print($currPage . $nl);//debugging
//Link Structure
echo "<div id=\"nav\">$nl<ul>$nl";
$linkArray = array (
'/linkstructure/index.php' => 'Home',
'/linkstructure/about.php' => 'About Us',
'/linkstructure/contact.php' => 'Contact',
'/linkstructure/services.php' => 'Services',
'/linkstructure/faq.php' => 'FAQ',
'/linkstructure/portfolio.php' => 'Portfolio'
);
foreach ( $linkArray as $url => $link ) {
if ($url !== $currPage) {
echo "<li><a href=\"$url\">$link</a></li>$nl";
} else {
echo "<li id=\"current\">$link</li>$nl";
}
}
echo "</ul>$nl</div>$nl";
?>