Useful snippet for highlight current menu item in PHP $full_name = $_SERVER['PHP_SELF']; $name_array = explode('/',$full_name); $count = count($name_array); $page_name = $name_array[$count-1]; <a class="<?php echo ($page_name=='where-to-buy.php')?'active':'';?>" href="where-to-buy.php">WHERE TO BUY</a> <a class="<?php echo ($page_name=='about.php')?'active':'';?>" href="about.php">ABOUT US</a> <a class="<?php echo ($page_name=='contact.php')?'active':'';?>" href="contact.php">CONTACT US</a>
0 comments:
Post a Comment