Using a dynamic sub-navigation

Hey guys,

I have some pages with sub pages. What I’d like is to have one
snippet that I can use on the top-level pages and sub pages for a
single dynamic sub navigation.

The general functionality works with <r:children:each> but once I go
2 pages deep, there are no sub pages so it breaks (obviously).

Is there either another tag OR some way of telling <r:children:each>
to only look based off of the parent folder?

Basic page functionality would be like so:

Thanks!!


Travis B.
[email protected]

-----Original Message-----
From: Travis B.
Sent: Wednesday, August 22, 2007 4:18 PM
Subject: [Radiant] Using a dynamic sub-navigation…

The general functionality works with <r:children:each> but once I go
2 pages deep, there are no sub pages so it breaks (obviously).

<r:find url="/articles/">

That builds a menu of all of the children of the /articles/ page.

Damien McKenna
Web D.
The LIMU Company

Heh, FYI in my last email, the hardcoded page should have been
“articles” not “about” :wink: My bad.


Travis B.
removed_email[email protected]

What if, instead of having to hardcode the “about” page, it was
possible for it to just pick up it’s parent? Therefore making it
truly dynamic instead of making it only dynamic for the “about” page?

Any ideas?


Travis B.
[email protected]

OK, let’s take a slightly different approach.

Seems the best way I can get a dynamic sub-nav is by creating a new
<r:if_url> for each section like this:

<r:if_url matches="/team/">
<r:find url="/team/">

This work, albeit a little lame, but it’s the best I can it seems we
can do… here’s one last question though…

Is there a way I could add a way to detect if I’m on a selected page,
then to say, add class=“selected” just like the <r:navigation> tag
(the <r:here> option)?

At first I thought it would be sweet to essentially embed the
<r:children> tag inside the <r:navigation> tag (this would create a
truly dynamic navigation) but it’s not built to do this.

Any other ideas out there?

Thanks guys!


Travis B.
[email protected]

Hey Ryan, thanks for the link.

Let’s say I have this rendering sub-pages for a nav…

How could I employ your code to render something with the

  • which
    page is loaded gets,
      <li><r:link class="selected" /></li>
    

    appended to it? This is what I am not sure about…


    Travis B.
    [email protected]

  • Travis,

    <r:nav /> will automatically attach the class “current” to the


  • tag of the current page in the hierarchy:
  • A Sub Page
  • Or, you could use <r:if_self /> like this:

    <r:children:each>
    <li<r:if_self> class=“current”</r:if_self>><r:link />


  • </r:children:each>

    On Aug 23, 2007, at 5:33 PM, Travis B. wrote:

    Travis B. > navigation_tags/ >
      > >> >>
    >> (the option)? >> Travis B. >>>> Sent: Wednesday, August 22, 2007 4:18 PM >>> >>> Radiant mailing list > > Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant

    Ryan H.
    Art of Mission, Inc.
    3720 Gattis School Rd #800 PMB 245
    Round Rock, TX 78664

    800-722-1492

    www.artofmission.com
    [email protected]

    I made an extension that might work for you:
    http://svn.artofmission.com/svn/plugins/radiant/extensions/
    navigation_tags/

    This tag:
    <r:nav />

    Outputs something like this:

    Or you can build your own using the tags:
    <if_children />
    <if_self />
    <if_ancestor_or_self />

    See http://svn.artofmission.com/svn/plugins/radiant/extensions/
    navigation_tags/lib/navigation_tags.rb for details.

    On Aug 23, 2007, at 12:20 PM, Travis B. wrote:

        <li><r:link/></li>
    

    then to say, add class=“selected” just like the <r:navigation> tag

    From: Travis B.
    </r:children:each>
    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


    Ryan H.
    Art of Mission, Inc.
    3720 Gattis School Rd #800 PMB 245
    Round Rock, TX 78664

    800-722-1492

    www.artofmission.com
    [email protected]

    Hot shit!

    :stuck_out_tongue:


    Travis B.
    [email protected]

    This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs