Active link

Hi, I need to use for active link another style as is mentioned below
but it doesnt works. What is bad in my code?

Thank you.

looks like navigation tag is what you need:

http://lists.radiantcms.org/pipermail/radiant/2006-November/002547.html

nurullah wrote:

looks like navigation tag is what you need:

http://lists.radiantcms.org/pipermail/radiant/2006-November/002547.html

But if I want to generate links automaticaly so I dont want to fill it
into the “urls” element of “r:navigation” tag. How can I do it? Can you
give me example or edited version of my code? Thank you.

Vladimir,

You need something like the <r:if_ancestor_or_self> tag that has been
discussed previously on the list. Radius tags don’t allow other Radius
tags inside their attributes.

Here’s the tag definition:

tag ‘if_ancestor_or_self’ do |tag|
tag.expand if tag.locals.page == tag.globals.page ||
tag.globals.page.ancestors.include?(tag.locals.page)
end

Then you could write something like this in your page/layout/snippet:

    <li<r:if_ancestor_or_self>id=“current”</r:if_ancestor_or_self>><r:title />
    </r:children:each>
    </r:find>

Hope this helps.

Sean

Vladimir Beran wrote:

Where I have to put the tag definition to use the new tag?

I have a feeling we’ll be adding that to core Real Soon Now ™. I
don’t recommend this as a general practice, but you can put the code I
previously posted in a block at the bottom of config/environment.rb:

Page.class_eval do

paste the code inside here

end

Sean

Where I have to put the tag definition to use the new tag?

If I added this code to mentioned file and use the tag in Radiant
interface, there is a text next each links telling me that undefined tag
`if_ancestor_or_self’.

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