October 10, 201214 yr I'm new here on the forum, and I have a problem I can not solve ... I want that when I click on the menu it becomes selected and when I change the page selection is for the menu page is too just do not know how to do this ... could someone help me? my code <div id="menu"> <ul> <li><a href="<?php echo $urlbase_config; ?>" title="Home">Home</a></li> <li><a href="<?php echo $urlbase_config; ?>services" title="Services">Services</a></li> <li><a href="<?php echo $urlbase_config; ?>work" title="Work">Works</a></li> <li><a href="<?php echo $urlbase_config; ?>contact" title="Contact">Contact</a></li> </ul> </div><!--menu--> Edited October 10, 201214 yr by Psythis
October 10, 201214 yr I think you mean that you want the current page link highlighted in the menu. Have a look at http://www.wickham43.net/highlighthome.php Item 1 is simple but not recommended as you cannot use that method with a PHP "include" file. Items 2, 3 and 4 are better.
October 10, 201214 yr Author I tried based on that link and could not ... Anyone have any other ideas? Just missing at this site ... I'm using everything in header.php file that has all the header data, the menu is dynamic and takes the url variable $urlbase_config ... any tips guys? I'm trying to use a code like this <a href = "index.php? Page = nav / start" <? php if ($ _GET ['page'] == "nav / start") {echo 'class = "active"';}?> How to use my menu that is by variable? <a href = "<? php echo $ urlbase_config;?>" title = "Home"> Home </ a> Edited October 10, 201214 yr by Psythis
October 10, 201214 yr Please try this method for active menu if you use a unique header file <?php $currentFile = $_SERVER["PHP_SELF"]; $parts = Explode('/', $currentFile); $url= $parts[count($parts) - 1]; ?> <ul> <li ><a <?php if($url=="index.php") { ?> class="mover" <?php } ?> href="index.php"> Home </a></li> <li><a <?php if($url=="greenfrog.php") { ?> class="mover" <?php } ?> href="greenfrog.php">Green Frog</a></li> </ul> Working demo please go through our website http://www.greenfrog.in Edited October 10, 201214 yr by arunsuku4u
Create an account or sign in to comment