Jump to:

23552 Posts in 19359 Topics by 2891 members

General Questions

SilverStripe Forums » General Questions » Unexpected behavior from Menu() in templates

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1033 Views
  • scpi
    Avatar
    Community Member
    21 Posts

    Unexpected behavior from Menu() in templates Link to this post

    I'm using Menu(3) in my templates to display local navigation, and I'm getting several menus rendered on a single page. That's not exactly what I was expecting, and I can't figure out what's happening from looking at the docs.

    My site is broken up into five main sections, each section has several sub-categories, and all my content lives in those categories. I'm three levels down in the tree, so I use Menu(3) navigation within a given section. What I get is the correct navigation menu for the page I'm looking at, plus the menus for siblings of the category I'm in. Is this normal behavior for Menu(), or have I done something horribly wrong?

    For example, if my tree looks like this...

    +Products
    |+ Widgets
    |-+ Airplane widgets
    |--- airwidget1
    |--- airwidget2
    |-+ Submarine widgets
    |--- subwidget1
    |--- subwidget2
    |+ Doodads
    |+ Sprockets
    +Services
    |+Psychic consultation
    |+Rocket surgery

    ...then when I'm in the Airplane Widgets section I get the proper menu for that section, but I also get the menu for the Submarine Widgets section.

  • scpi
    Avatar
    Community Member
    21 Posts

    Re: Unexpected behavior from Menu() in templates Link to this post

    Fixed!
    I never did get Menu() working the way I thought it should. I just realized that I could get the results I wanted using <% control Level(3) %> instead of <% control Menu(3) %>.

    1033 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.