Selecting current page in menu

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 ?

The typical way is to use <r:navigation>. This snippet should do what
you like:

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

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 !!!

That’s great!

Cheers,
Sean

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs