treehouse : what would you like to learn today?
Web Design Web Development iOS Development

menu id's and includes

  • Hi all...

    I have intregated a menu and used a php included :
    <? php include('menu.php'); ?>


    Now i have a problem because i want to integrate an
    id=\"current\"
    to the menu item of the visited page. Is there a solution for this?

    Thanks for the help!
  • The best way to go here is to not use unique ID's on the list items, but on the body element itself. That way your "included" menu code never needs to change. More on this:

    http://css-tricks.com/id-your-body-for- ... ecificity/
  • I asked a very similar question a while back and got given this code to use the file name to dynamically load the body id's.

    <?php  
    $fname = basename($_SERVER['PHP_SELF'], \".php\");

    ?>


    Thought it might help . . .