Grow your CSS skills. Land your dream job.

menu id’s and includes

  • # August 13, 2008 at 5:52 am

    Hi all…

    I have intregated a menu and used a php included :

    Code:
    < ? php include('menu.php'); ?>

    Now i have a problem because i want to integrate an

    Code:
    id=”current”

    to the menu item of the visited page. Is there a solution for this?

    Thanks for the help!

    # August 13, 2008 at 12:07 pm

    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/

    # August 14, 2008 at 8:10 am

    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.

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

    ?>

    Thought it might help . . .

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".