Dynamic Navigation with Active Class

I am trying to make a dynamic top navigation menu for a website that uses an ‘active’ class to notate what page the user is on. The script below somewhat works but nor right. It’s just a series of IF statements to determine the page name and assign it a class or not. I have a similar system for page titles and meta data.

now each file sees it and all the unactive links look and act fine, however, when you are on the active page, it takes the active pages name in the menu (ie, Home, about, contact, etc…) turns it grey makes it small, throws it up about 10px above the others, moves it to the the far right of the menu list, and finally makes it unclickable.

Any ideas as to why this wouldnt work? Thank you guys in advance for your time and assistance.

[php]<?php $currentPage = basename($_SERVER['SCRIPT_NAME']); ?>

<div id="templatemo_menu">




<ul>
    <?php echo "\n"; if ($currentPage == 'index.php'){ ?><li class="current fast">Home</li><?php     } else { ?><li><a href="index.php">Home</a></li><?php } ?>
    <?php echo "\n"; if ($currentPage == 'about.php'){ ?><li class="current fast">About</li><?php    } else { ?><li><a href="about.php">About</a></li><?php } ?>
    <?php echo "\n"; if ($currentPage == 'services.php'){ ?><li class="current fast">Services</li><?php } else { ?><li><a href="services.php">Services</a></li><?php } ?>
    <?php echo "\n"; if ($currentPage == 'gallery.php'){ ?><li class="current fast">Gallery</li><?php  } else { ?><li><a href="gallery.php">Gallery</a></li><?php }  ?>
    <?php echo "\n"; if ($currentPage == 'contact.php'){ ?><li class="current fast">Contact</li><?php  } else { ?><li><a href="contact.php">Contact</a></li><?php }  ?>
</ul>

</div> <!-- end of menu -->
[/php]

that is my ‘menu.php’ that is included in each file like this: <? php include'includes/menu.php'; ?>

Sponsor our Newsletter | Privacy Policy | Terms of Service