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, biapar, Willr, Ingo, swaiba, simon_w

Sub Menus


Reply


5 Posts   815 Views

Avatar
JustinErswell

Community Member, 1 Post

19 November 2009 at 12:33am

Hi Everyone

I have a template that has a sub page type, which has a menu which is on level 3. this menu in the design is within a separate div tag what <%%> controls would I need to wrap around this to get it only to display the child objects of the parent which is a level 2 page?

Cheers

Justin

Avatar
dalesaurus

Community Member, 283 Posts

19 November 2009 at 3:14pm

Hmmm this is a hierarchy fun-time problem. You need to traverse up to the parent and get it's menus

<% control Parent %>
<% control Menu(1) %>

<% end_control %>
<% end_control %>

Avatar
banal

Community Member, 901 Posts

19 November 2009 at 8:33pm

I think it should rather be

<% control Parent %><!-- move scope to parent -->
<% control Children %><!-- iterate over parents children -->

<% end_control %>
<% end_control %>

Menu(1), Menu(2) etc. are global. No matter where you call them, they always return the first, second etc. level of pages.

Avatar
patjnr

Community Member, 101 Posts

19 November 2009 at 10:30pm

reference http://doc.silverstripe.org/doku.php?id=built-in-page-controls&s=page%20controls

try to control your levels which returns the current section you are in.
its scope is limited as compared to Menu which is global

ta

Avatar
dalesaurus

Community Member, 283 Posts

20 November 2009 at 4:32pm

Ahhh, yeah overlooked that with Menu(). Those guys are smart (and righter)