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

lend me your eyes (solved)

  • can someone please review the following code for me. basicly im using the fix chris mentioned in this video ">http://css-tricks.com/new-screencast-current-nav-php-body-id/


    everything works fine, except that its only working for 2 of my pages. im guessing that i may have typed something wrong someone. this is what ive added to my css file


    body#photos ul.nav li.photos a {
    background: url(images/navphotos.jpg) bottom no-repeat;
    }

    body#news ul.nav li.news a {
    background: url(images/navnews.jpg) bottom no-repeat;
    }

    body#about ul.nav li.about a {
    background: url(images/navabout.jpg) bottom no-repeat;
    }

    body#contact ul.nav li.contact a {
    background: url(images/navcontact.jpg) bottom no-repeat;
    }


    this is the code that i used from the video...
    </head>

    <?php
    $page = $_SERVER['REQUEST_URI'];
    $page = str_replace(\"/\",\"\",$page);
    $page = str_replace(\".php\",\"\",$page);
    $page = str_replace(\"?s=\",\"\",$page);
    $page = $page ? $page : 'default'
    ?>


    <body id=\"<?php echo $page ?>\">


    and this is the rest of the anchor link code thats lower in the header.php file...
    <div id=\"nav\">
    <ul class=\"nav\">
    <li class=\"first\"><a href=\"<?php bloginfo('url'); ?>\"></a></li>
    <li class=\"photos\"><a href=\"/photos/\">photos</a></li>
    <li class=\"news\"><a href=\"/news/\">news</a></li>
    <li class=\"about\"><a href=\"/about/\">about</a></li>
    <li class=\"contact\"><a href=\"/contact/\">contact</a></li>
    </ul>
    </div>


    again, the first two pages are working fine, its just the about page and the contact page to which are not taking on the active state. do anyone see anything that i may have mistyped, particularly in the first bit of code??

    one more detail which i just discovered. everything is working in FF, it appears that only the 2 of the states are working in IE. weird



    folks i tellya, i sat up here and trouble shooted this thing for at least an hour before i decide to ask for help to no avail. then all of a sudden will checked to see if anyone responded, i checked IE and its working. man does it normally take so long for changes to take effect in IE? it usually doesnt for me. anyhow its working. maybe next time i need to delete the history or something?
  • Hi Dave, it was probably a caching problem.

    Ctrl+F5 (Hard Refresh) usually takes care of this problem