Navigation Bar Links

Discussion in 'PHP' started by Omzy, Oct 23, 2008.

  1. #1
    So I have a navigation bar on my PHP site, I have made it such that the links change color on hover using CSS, but how do I make it highlight the link that corresponds to the page that the user is currently on?

    For example if I'm on www.mysite.com/contact.htm I would like the 'Contact' link to be highlighted.

    I beleive this needs to be done in the PHP code rather than CSS.
     
    Omzy, Oct 23, 2008 IP
  2. sastro

    sastro Well-Known Member

    Messages:
    214
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #2
    <?
    $page=strtolower($_SERVER["REQUEST_URI"]);
    if($page=='/contact.htm'){
    echo '<div id="highlighcss">Contact US</div>';
    }elseif(...
    ...
    .
    .
    }
    ?>
     
    sastro, Oct 23, 2008 IP
  3. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Right I get it. Thanks!
     
    Omzy, Oct 23, 2008 IP