The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Current Nav Highlighting

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #23250

    I am sorry to ask all of these silly questions all the time, but being new to this, I keep running into problems. Sometimes it is a simple fix, like closing a “ul” tag, and sometimes it is more complicated, like activating the mod_rewrite module, but you guys have always been there to help me out. So, again, I have encountered another problem that I need help with.

    In Chris Coyier’s video #36 (Current Nav Highlighting), I followed everything, but it does not seem to be working. Here is the code I have that is relevant to the situation (header.php):

    $page = $_SERVER;
    $page = str_replace("/","",$page);
    $page = str_replace(".php","",$page);
    $page = str_replace("?s=","",$page);
    $page = $page ? $page : 'default'

    And here is my CSS code (style.css):

    ul#main-nav li a:hover,
    ul#extra-nav li a:hover,
    body#home ul#main-nav li.home a,
    body#projects ul#main-nav li.projects a,
    body#studio ul#main-nav a,
    body#forums ul#main-nav li.forums a,
    body#support ul#extra-nav a,
    body#default ul#main-nav li.home a {
    background: #FFFFFF;
    color: #333333;

    If you need to see anything else to help me solve why this is not working, just let me know, and I will get back to you as soon as possible. Thank you in advance!


    I hate to bump for bump’s sake, but this is almost on the fourth page and no one has yet attempted to help me on this. I would greatly appreciate any solutions you guys can give me on how to solve this little problem. Thank you!


    What does a typical url look like to you? What exactly are you trying to take from the url and put as the body id?


    Well, since I am working locally at the moment, my URL’s look a little something like this:


    Et cetera. What I am trying to do is take the last word in the permalink, so like, let us say there is a “Projects” page with the URL of:


    Then, I want the body id to be simply “projects.” Right? I think that is how this works. And if someone puts in a random string of letters in the URL, it will default to the home page.


    This was almost to the third page again. I feel like jamy_za was trying to help me, but I am obviously not having an epiphany over this. If someone could simply point out what I am doing wrong here, that would be great. Thanks in advance!


    If you watch the video, he talks about how using “current” as the id will not work in this situation. I forget why he says that, but he does. If you want to take a look at the video, it is here:

    It’s a bit long, but you can skip most of it, if you just want to see how he codes it. I believe I have everything right, but it does not seem to be working, which would suggest that I do not.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Other’ is closed to new topics and replies.