I'm sure the solution to this is simple, but I just can't figure it out. First, I have a few variables set.
$url = $_SERVER['PHP_SELF'];
$path = dirname($url);
if ($path != "/")
$path .= "/";
$filenotfound = "/nofile.php";
Then, I put all the links of my nav into an array, and echo them out. If the user is on the current page, CSS displays a small arrow in front of the link. Sounds easy enough... and it works. Look: http://www.mzanime.com
<?php
$navigation = array(
"nav" => array('/','/av/','/am/','/az/','/aw/','/ss/'),
"link" => array('Home','Anime Movies','Anime Music','J-pop Videos','Wallpapers','Screen Shots'),
);
$c = 0;
foreach ($navigation['nav'] as $val) {
echo "\n";
if (($val == $path) && ($val != $filenotfound)) {
echo " <li id=\"at\">";
} else {
echo " <li>";
}
echo "<a href=\"". $val ."\">" . $navigation["link"][$c++] . "</a></li>";
} echo "\n\n";
?>
But I have this PHP block broken into sections because the nav is 3 different sections. The PHP code boce is only the first section. So my question is, why doesn't PHP append <li id="at"> to the following sections?
<?php
$navigation = array(
"nav" => array('/dl/winamp.php','/dl/flash.php','/dl/aimicons.php','/policies.php','/links.php'),
"link" => array('WinAMP Skins','Flash Games!','Anime AIM icons','Download Policies','Anime Links'),
);
$c = 0;
foreach ($navigation['nav'] as $val) {
echo "\n";
if (($val == $path) && ($val != $filenotfound)) {
echo " <li id=\"at\">";
} else {
echo " <li>";
}
echo "<a href=\"". $val ."\">" . $navigation["link"][$c++] . "</a></li>";
} echo "\n\n";
?>
Any help would be fantastic!