Difficulties with a navigation menu and selectively showing children

Hi. I recently started using Radiant to host http://www.vfct.com/ .
I’m not using many of the more sophisticated features (nearly everything
is hard-coded in some way). I’d like to get away from having to
hard-code my sidebar navigation (see
http://www.vfct.com/counterterrorism/odin-uldris/ for a good example of
what I’m doing.

Example:

Counterterrorism
Child Page 1
Child of Child Page 1
Child Page 2

I want to display all of the children of the parent page, and then
display the children of the current page only. In this example, Child
Page 2 has children, but I am not showing them.

I’ve gotten close using
<r:children:each>

But then I get all second level children including those under Child
Page 2. I attempted to use

<r:if_url matches=“<r:url />”>…</r:if_url> but it looks like <r:url />
isn’t executing or at least isn’t matching (it does work if I type the
url in manually instead of using the tag).

An attempt to do this with r:navigation, feeding it the results of
r:children:each failed as well, as r:children:each didn’t seem to
execute within

<r:navigation urls=“<r:children:each><r:title />: <r:url
/>…</r:children:each>”…

Are the problems I’m experiencing (under 0.6.2) normal and expected? If
so, is there a workaround? If this is not normal, could someone provide
a quick example of working code?

Thanks.

Lou Brothers wrote:

I want to display all of the children of the parent page, and then
display the children of the current page only. In this example, Child
Page 2 has children, but I am not showing them.

I haven’t tried it but this might work (or something like this):

<r:parent> ← switch the context to the parent of this page
<r:children:each> ← for each child (of the page’s parent)
<r:if_this_is_the_current_page> ← sorry, I can’t remember
how to match this
<r:children:each> <— for each child of this page
<r:link /> ← or whatever you want to do
</r:children:each>
</r:if_this_is_the_current_page>
</r:children:each>
</r:parent>

Maybe, these will help:

  1. http://lists.radiantcms.org/pipermail/radiant/2006-July/000888.html
  2. Newb Menu Question - Radiant CMS - Ruby-Forum

Based on #1 above, you may need to match using: <r:page:if_url>
because that works at the level of the current page, not the level of
the current context (which in a nested scheme will be the child/ parent
page).

Hope this helps.

Cheers,
Mohit.
12/5/2007 | 12:14 AM.

On Tue Dec 04 16:14:06 UTC 2007, Mohit S. [email protected] wrote:

how to match this

Based on #1 above, you may need to match using: <r:page:if_url>
because that works at the level of the current page, not the level of
the current context (which in a nested scheme will be the child/ parent
page).

Hope this helps.

Cheers,
Mohit.
12/5/2007 | 12:14 AM.

I can’t seem to find a reference to an example of determining if a url
is the url of the current page. My attempts at using <r:if_url
matches…> have not been successful.

Lou,

Here’s a tag definition you can drop into your project’s extension
that might help.

tag ‘if_self’ do |tag|
tag.expand if tag.locals.page == tag.globals.page
end

Since we have better support for detecting the globally rendering page
now, we should probably add it to the core.

Sean

On Dec 5, 2007, at 9:52 AM, Sean C. wrote:

Here’s a tag definition you can drop into your project’s extension
that might help.

tag ‘if_self’ do |tag|
tag.expand if tag.locals.page == tag.globals.page
end

Since we have better support for detecting the globally rendering page
now, we should probably add it to the core.

+1


John L.
http://wiseheartdesign.com