[Radiant] active link

Sean Cribbs seancribbs at gmail.com
Wed Apr 9 08:13:22 CDT 2008


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:

<ul>
  <r:find url="/">
    <r:children:each by="id" order="asc">
        
<li<r:if_ancestor_or_self>id="current"</r:if_ancestor_or_self>><a 
href="<r:url />"><span><r:title /></span></a></li>
    </r:children:each>
  </r:find>
</ul>

Hope this helps.

Sean

nurullah wrote:
> looks like navigation tag is what you need:
>
> http://lists.radiantcms.org/pipermail/radiant/2006-November/002547.html
>
> On 4/9/08, Vladimir Beran <vberan at centrum.cz> wrote:
>   
>> Hi, I need to use for active link another style as is mentioned below
>> but it doesnt works. What is bad in my code?
>>
>> <ul>
>>   <r:find url="/">
>>     <r:children:each by="id" order="asc">
>>       <r:if_url matches="<r:url />">
>>         <li id="current"><a href="<r:url />"><span><r:title
>> /></span></a></li>
>>       </r:if_url>
>>       <r:unless_url matches="<r:url />">
>>         <li><a href="<r:url />"><span><r:title /></span></a></li>
>>       </r:unless_url>
>>     </r:children:each>
>>   </r:find>
>> </ul>
>>
>> Thank you.
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Radiant mailing list
>> Post:   Radiant at radiantcms.org
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>
>>     
> _______________________________________________
> Radiant mailing list
> Post:   Radiant at radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
>   



More information about the Radiant mailing list