Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Not sure how to say this but I'll try.

How do you get it so nav links will be highlighted when your viewing the page it's linked to. Just like the way it works on vanilla forums up top.
«1

Comments

  • BenBen
    edited September 2005
    You assign an extra class to the link that relates to that page. With the vanilla tabs, all the links have class="TabOff" except the active one, which is defined by class="TabOn" this means that, that specific tab can be given extra styling.
  • I suppose I won't be able to do that if I'm calling information into an index page with a php command?
  • like... index.php?page=blahdeblah type thing?

    You'd just need to set up a little If statement for each tab, like If the page equals 'news' then echo TabOn otherwise echo TabOff
  • well, I suppose I can show you the site and you can help determine the best route? If it's not too much hassle, that is. http://onemanshortproductions.com
  • you could set a body id on your pages if you want to do a pure css version. then in the css when the body id is present it will apply a different style e.g. <body id="home"> <a href="/" id="homeNav">home</a> then in the css put: #home #homeNav{ font-weight:bold; }
  • with regards to doing this with php, i'm not a programmer so turned to the wordpress coddex for a good tutorial on this: http://codex.wordpress.org/Dynamic_Menu_Highlighting
  • at timberford: doh, I should have thought of that one. So much easier than the PHP method!
  • glad to help. it's a handy technique, i use it all the time.
  • edited October 2005
    trouble with that is my php code just calls a page into the body... there is no seperate bodies... <body> <div id="wrapper"> <div id="banner"></div> <div id="nav"> <ul> <li><a href="?news" title="Home">Home</a></li> <li><a href="?aboutus" title="About Us">About Us</a></li> <li><a href="?currentprojects" title="Current Projects">Current Projects</a></li> <li><a href="?media"title ="Media">Media</a></li> </ul> </div> <div id="content"> <?php $query = $_SERVER['QUERY_STRING']; $query = explode(':',$query); if(empty($query[0]) && empty($query[1])) { include 'news.php'; } elseif(empty($query[1])) { include $query[0].'.php'; } else { include $query[0].'/'.$query[1].'.php'; } ?> </div>
  • so you're saying you use a single template for all your pages, regardless of their content?
  • in that case you could use a statement that detects which page it is and inserts an id into the body and still use the css method i mentioned.
  • I'm total novice to php... how would I go about this?
  • well, on the basis that your pages are defined in a ?page=whatever statement, for your css if you use a body tag such as: <body id="<?php echo $_GET['page']; ?>"> Which should work. I think.
  • edited October 2005
    That doesn't work... It produces a blank id statement... I also tried useing echo $_SERVER['QUERY_STRING']; which didn't work... I'm not even sure what that would so anyway, lol... I posted the actual coding I use above... so if that can help you at all. Thanks for being helpful. my pages arent ?page=whatever they are ?whatever
  • um? I'm not sure that'l work. Though i'm probably wrong. As far as i know it needs to be ?variablename=variablecontent
  • edited October 2005
    It does work.... http://onemanshortproductions.com is a working example of it. http://onemanshortproductions.com/?news http://onemanshortproductions.com/?opportunities etc... Or are you saying you don't know how to get it to echo the page when it's in that form?
  • Isnt that your site? How do you get it to work out what page to load up then?
  • edited October 2005
    I have an index page that is designed the way I want... in the body tag I insert the php command I posted 10 posts up... I have individual php files that it calls into the body of the index page. When I click on say Opportunities link the href="?opportunities" it then calls opportunities.php into the body.
This discussion has been closed.