# How to exclude current children from a list of childrens

**URL:** <https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082>\
**Category:** Radiant CMS\
**Created:** [September 7, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082 "2007-09-07T18:47:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 7, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/1 "2007-09-07T18:47:24Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 7, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/2 "2007-09-07T19:45:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 7, 2007, 9:02pm UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/3 "2007-09-07T21:02:35Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 7, 2007, 9:12pm UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/4 "2007-09-07T21:12:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 8, 2007, 1:37am UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/5 "2007-09-08T01:37:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 8, 2007, 4:36am UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/6 "2007-09-08T04:36:19Z")

</div>

Your other option is this tag definition:

tag “unless\_self” do |tag|  
tag.expand unless tag.globals.actual\_page == tag.locals.page  
end

- 

Sean

---

<div class="post-metadata">

**Author:** ![sgabello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sgabello](https://www.ruby-forum.com/u/sgabello)\
**Post date:** [September 8, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/how-to-exclude-current-children-from-a-list-of-childrens/114082/7 "2007-09-08T13:23:49Z")

</div>

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