chrismarsden Posted May 28, 2010 Share Posted May 28, 2010 Ok just a bit of menu help, i want to basicly show a static active image on a link when you on a page but i have the menu in an include so obviously if i set that static to home the hover over that happens on the other pages will work but no matter what page im on it will show the main page as the page your on. <div class="menu"> <ul> <li class="active"><a href="index.php"><b>Home</a></li> <li><a href="">Services</a></li> <li><a href="about.php">About Us</a></li> <li><a href="">Portfolio</a></li> <li><a href="">Contact Us</a></li> </ul> </div> basicly if im on the about page i want the active to move aswell.... any ideas? Quote Link to comment Share on other sites More sharing options...
-Karl- Posted May 29, 2010 Share Posted May 29, 2010 <?php $referer = basename($_SERVER['SCRIPT_NAME']); ?> <div class="menu"> <ul> <li <?php if ($referer == 'index.php') { echo 'class="active"'; } ?>><a href="index.php"><b>Home</a></li> <li <?php if ($referer == 'services.php') { echo 'class="active"'; } ?>><a href="">Services</a></li> <li <?php if ($referer == 'about.php') { echo 'class="active"'; } ?>><a href="about.php">About Us</a></li> <li <?php if ($referer == 'portfolio.php') { echo 'class="active"'; } ?>><a href="">Portfolio</a></li> <li <?php if ($referer == 'contact.php') { echo 'class="active"'; } ?>><a href="">Contact Us</a></li> </ul> </div> Something similar to that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.