Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

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

Unexpected behavior from Menu() in templates

Go to End

2 Posts   1227 Views


Community Member, 21 Posts

20 August 2009 at 8:12am

Edited: 20/08/2009 9:02am

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...

|+ Widgets
|-+ Airplane widgets
|--- airwidget1
|--- airwidget2
|-+ Submarine widgets
|--- subwidget1
|--- subwidget2
|+ Doodads
|+ Sprockets
|+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.


Community Member, 21 Posts

21 August 2009 at 4:51am

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) %>.