In each children page of my project I need to list all other childrens
of the same parent. I tried this tags:
<r:parent>
<r:children:each>
<r:unless_url matches="\Q<r:page><r:url/></r:page>\E">
"<r:link
/>"</r:unless_url>
</r:children:each>
</r:parent>
but it didn’t work.
Any help is very apreciated!!!
thanks!
Your code below is incorrect. Radius tags follow the same structural
rules as standard XML (don’t expect the tags in the ‘matches’ attribute
to
expand).
Try with the tag.
/AITOR
Thanks Aitor!
I understood why it didn’t work! But <r:navigation/> has the same
problem: I can’t build url list with radiant’s tag…
I think there’s no solution for this issue…
<r:navigation> has been a pain-point for a long time. There was some
discussion a month or two ago about how to change it. I doubt it will
stay the same for very much longer.
Sean
Back door extension to the rescue:
<r:erb>
<% page = tags.locals.page
parent = page.parent
siblings = parent.locals.page.children
siblings.each do |sibling|
if sibling != page
%>
<r:link />
<% end
end
%>
</r:erb>
I did not test the code above, so beware!
/AITOR
Your other option is this tag definition:
tag “unless_self” do |tag|
tag.expand unless tag.globals.actual_page == tag.locals.page
end
Sean
The code above does not work. The correct one is this:
<r:erb>
<% page = tag.locals.page
parent = page.parent
siblings = parent.children
siblings.each do |sibling|
if sibling != page
%>
<%= sibling.slug %>
<% end
end
%>
</r:erb>
There is a bug (feature?) in the current version of the back door
extension that prevents the expansion of Radius tags enclosed inside
loops
in tags. So putting a <r:link> inside the ‘if’ above won’t work
as
expected. I will take a look to this and update the extension.
The solution given by Sean is much cleaner.
One thing i miss from Radiant is an easy way to make it "more
programmable" without resorting to extensions or to ugly code inside
/ tags. Maybe it’s time for a revamp of the back door
extension…
/AITOR