Joe,
Here is what I use. I'm not sure if its what others use but I like it.
It uses two snippets, one of which calls itself recursively:
nav (use this in your layout):
<ul class="nav">
<r:find url="/"><r:snippet name="nav_part" /></r:find>
</ul>
nav_part:
<r:children:each>
<r:unless_content part="no_nav">
<r:if_ancestor_or_self>
<li class="<r:if_children>node</
r:if_children><r:unless_children>leaf</r:unless_children><r:if_self>
self</r:if_self>">
<r:link />
<r:unless_content part="no_children">
<r:if_children>
<ul>
<r:snippet name="nav_part" />
</ul>
</r:if_children>
</r:unless_content>
</li>
</r:if_ancestor_or_self>
<r:unless_ancestor_or_self>
<li class="leaf"><r:link /></li>
</r:unless_ancestor_or_self>
</r:unless_content>
</r:children:each>
This will create a hierarchical of the sort you're looking for,
although it will create it as deep as your your pages... you may need
to find a way to restrict things.
I ran into two problems off the bat, mostly because its rather
indiscriminate (or rather it was). The first problem I had was that I
was getting links to my RSS page, which was not what I wanted. So I
added a part to the page called no_nav. Not entirely clear but any
page that has that part will not be in the navigation. The second was
with my news section. This sort of navigation doesn't work well.
Instead of trying to figure out how to break the navigation into
sections I decided not to put the children of the news page in the
navigation. I achieve this by putting a part on the news page called
"no_children".
If you want to only go to n layers deep, you would need to modify this
somewhat, but I think you get the general idea.
I'll leave the styling to you.
On 21-Nov-08, at 5:07 PM, Joe Van Dyk wrote:
Hi,
Any ideas on how I could automatically create this sort of navigation?
http://img.skitch.com/20081122-j1ew9ww9xxprntjnwbck1mpk93.jpg
The navigation tag wouldn't support that, right?
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant