Jump to:

22976 Posts in 11702 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Sub Menus

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: 703 Views
  • JustinErswell
    Avatar
    Community Member
    1 Post

    Sub Menus Link to this post

    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

    Attached Files
  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Sub Menus Link to this post

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

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Sub Menus Link to this post

    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.

  • patjnr
    Avatar
    Community Member
    101 Posts

    Re: Sub Menus Link to this post

    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

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Sub Menus Link to this post

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

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