librelist archives

« back to archive

Using display_menu to only display pages below argument page

Using display_menu to only display pages below argument page

From:
David Long
Date:
2011-11-05 @ 18:26
I have a portfolio on my site and am trying to add a subnavigation to the
side bar of the site to list out the different pages within the portfolio.
 I am right now using the following code to list out the pages:

- display_menu(Nesta::Menu.for_path('/portfolio'), :class => "side_menu",
:levels => 2)


I would like to do something like Menu.for_path('/portfolio/*'), but that
doesn't work; it gives an error.

-- 
*
Do not be overcome by evil, but overcome evil with good.  - Romans 12:21 ESV

Dave Long*
Web Application Consultant

(203) 626-1809
www.davejlong.com

Re: [nesta] Using display_menu to only display pages below argument page

From:
Graham Ashton
Date:
2011-11-06 @ 21:10
On 5 Nov 2011, at 18:26, David Long wrote:

> I have a portfolio on my site and am trying to add a subnavigation to 
the side bar of the site to list out the different pages within the 
portfolio.  I am right now using the following code to list out the pages:
> 
> - display_menu(Nesta::Menu.for_path('/portfolio'), :class => 
"side_menu", :levels => 2)
> 
> I would like to do something like Menu.for_path('/portfolio/*'), but 
that doesn't work; it gives an error.

I'm afraid it's not designed to work like that. It only includes only the 
items that you explicitly list in menu.txt, nested within the portfolio 
page (indent nested menu levels with two spaces).

You could write a new Ruby helper method that would do what you wanted, 
listing all the pages whose path starts with /portfolio and then printing 
out <li> tags for each one.

Graham

Re: [nesta] Using display_menu to only display pages below argument page

From:
David Long
Date:
2011-11-07 @ 01:41
Sorry. I don't think I was very clear with my question. I have a menu.text
file setup like the following:

portfolio
  portfolio/life-in-your-way
  portfolio/more-dspobjects
  portfolio/cfstripe

But when I use the display menu method with the portfolio path I get the
pages with portfolio in the navigation but I want the navigation with only
the portfolio/* pages.
On Nov 6, 2011 4:10 PM, "Graham Ashton" <graham@effectif.com> wrote:

> On 5 Nov 2011, at 18:26, David Long wrote:
>
> > I have a portfolio on my site and am trying to add a subnavigation to
> the side bar of the site to list out the different pages within the
> portfolio.  I am right now using the following code to list out the pages:
> >
> > - display_menu(Nesta::Menu.for_path('/portfolio'), :class =>
> "side_menu", :levels => 2)
> >
> > I would like to do something like Menu.for_path('/portfolio/*'), but
> that doesn't work; it gives an error.
>
> I'm afraid it's not designed to work like that. It only includes only the
> items that you explicitly list in menu.txt, nested within the portfolio
> page (indent nested menu levels with two spaces).
>
> You could write a new Ruby helper method that would do what you wanted,
> listing all the pages whose path starts with /portfolio and then printing
> out <li> tags for each one.
>
> Graham
>

Re: [nesta] Using display_menu to only display pages below argument page

From:
Graham Ashton
Date:
2011-11-07 @ 08:07
On 7 Nov 2011, at 01:41, David Long <dave@davejlong.com> wrote:
> Sorry. I don't think I was very clear with my question. I have a 
menu.text file setup like the following:
> 
> portfolio
>   portfolio/life-in-your-way
>   portfolio/more-dspobjects
>   portfolio/cfstripe
> 
> But when I use the display menu method with the portfolio path I get the
pages with portfolio in the navigation but I want the navigation with only
the portfolio/* pages.
> 
Oh I see. I don't think it supports that. Sorry...