If_url and menu sub menus

I have a site structure like this. --> denote children

Main Page
–>scicomp
---->student_projects
---->instruments
------>gcms
------>ftir
------>sem
–>other areas

h3. Scientific Computing
<r:find url="/scicomp/">
<r:children:each order=“asc”>

  • <r:link />
    <r:if_url matches="/instrumentation/">
    <r:children:each order=“asc”>
    ** <r:link />
    </r:children:each>
    </r:if_url>
    </r:children:each>
    </r:find>

I want to have a sidebar menu that when the instruments section in
being viewed the children of the instruments page are listed. When
that section is not being viewed are hidden. I had though that the
above would do this but instead it always should the sub-menu. Any
thoughts.

FYI I love that radiant does all the right stuff to be DB agnostic.

Erik B. Ordway wrote:

</r:find>

I want to have a sidebar menu that when the instruments section in
being viewed the children of the instruments page are listed. When
that section is not being viewed are hidden. I had though that the
above would do this but instead it always should the sub-menu. Any
thoughts.

That’s because the <r:if_url /> tag is being evaluated within the
context of the child URL. You need to bump it back out so that it
references the current page’s url. Try this instead:

<r:page:if_url matches="/instrumentation/">

<r:page:if_url>

The <r:page /> tag changes the context back to the current page.


John L.
http://wiseheartdesign.com

Thanks. I keep forget the objecty nature of the tag syntax. It takes
a little getting used to but it is nice.

Erik B. Ordway wrote:

Thanks. I keep forget the objecty nature of the tag syntax. It takes
a little getting used to but it is nice.

Most of the time I think it’s what you would expect, but occasionally it
catches you by surprise. :slight_smile:


John L.
http://wiseheartdesign.com

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