I have this as my menu.
I need to identify which is the current page so I can set the
class="here"
How can I do that ?
<ul class="floatRight">
<li><a href="/" title="Home" class="here"> Home</a></li>
<li><a href="/shop/" title="Shop" >Shop</a></li>
<li><a href="/projects/" title="Projects">Projects</a></li>
<li><a href="/gallery/" title="Gallery">Gallery</a></li>
<li><a href="/aboutme/" title="About Me" >About Me</a></li>
<li><a href="/contactus/" title="Contact Us" class="last">Contact
Us</a></li>
</ul>
on 30.08.2008 00:58
on 30.08.2008 02:49
The typical way is to use <r:navigation>. This snippet should do what
you like:
<ul class="floatRight">
<r:navigation urls="Home: /| Shop: /shop/ | Projects: /projects/ |
Gallery: /gallery/ | About Me: /aboutme/ | Contact Us: /contactus/">
<r:normal><li><a href="<r:url />" title="<r:title />"><r:title
/></a></li></r:normal>
<r:here><li><a href="<r:url />" title="<r:title />"
class="here"><r:title /></a></li></r:here>
</r:navigation>
</ul>
Unfortunately, it won't let you add the "last" class, but you could add
that with JavaScript pretty easily. If you're using Prototype:
document.observe("dom:loaded", function(){
$$('li:last-child').invoke('addClassName', 'last'); });
Your other option is to use a bunch of <r:if_url> tags, one on each
link, to see whether you should add the "here" class.
Cheers,
Sean
on 30.08.2008 16:29
Sean, Thanks... I just pasted your code into my header and poof... it worked. I am starting to get it !!!! I am a 40 year programmer, but realize the power of things like Radiant CMS. I have a lot to learn, but I am SOLD on Radiant... Good community .... I will let y'all know when I get my 1st site up. It's my woodworking hobby site, but it will teach me a whole lot and then maybe I can sell a site !!!
on 30.08.2008 16:48
That's great! Cheers, Sean