Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Nested menus

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

Page: 1
Go to End
Author Topic: 2044 Views
  • mrwindupbird
    Avatar
    Community Member
    26 Posts

    Nested menus Link to this post

    I'm not sure if this is the right forum for this, but here goes...

    I am designing a site that needs nested sub-menus. For example, I have setup "MusicHolder" and "MusicPage" pages. Under the main MusicHolder page, I have a link to another MusicHolder page for a band. Now we're two MusicHolder pages in, and what's next is all the albums by this one band... but the list of "MusicPage" albums aren't listed in the 2nd MusicHolder submenu.

    e.g.

    -MusicHolder (Click here to see the list of bands)
    --MusicHolder (This is a cool band)
    ---MusicPage (This is the cool band's first album)
    ---MusicPage (This is the cool band's second album)
    ---MusicPage (This is the cool band's third album)

    etc. etc...

    So from the 2nd MusicHolder page, the sub-menu does not list the MusicPage pages with the list of albums... what to do??

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Nested menus Link to this post

    I'm not sure if I really understand what you're trying to do.. the structure you provided as example should be easy to do. To output sub-pages in the template, simply use the "Children" control? Eg. <% control Children %>

  • mrwindupbird
    Avatar
    Community Member
    26 Posts

    Re: Nested menus Link to this post

    It may well be quite easy to do... this is the first website I've tried to make, so I'm struggling against a steep learning curve at the moment.. Would the <% control Children %> tag go in the MusicPage.ss layout file?

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Nested menus Link to this post

    Well, it depends where your list should appear. If you want a list like proposed in your first post, you would build it using the Children control on the MusicHolder Page template to list the MusicPages.

    You can also output it like a navigation, so that it's always visible, no matter where you currently are on the site:

    <% control Menu(1) %>
       $Title <!-- MusicHolder -->
       <% control Children %>
          $Title <!-- MusicHolder Children, eg. cool band -->
          <% control Children %>
             $Title <!-- MusicPage -->
          <% end_control %>
       <% end_control %>
    <% end_control %>

    This is just an uncluttered example, but the generated markup might not really be useful. You should add some <ul> and <li> tags and of course links in there.

  • Naren
    Avatar
    Community Member
    21 Posts

    Re: Nested menus Link to this post

    Hi all,

    I was looking for nested menu module for silverstripe 3.0

    can anyone suggest me for the same.

    Thanks in advance

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Nested menus Link to this post

    Banal answered your question but in SS2.4 way so if u have 3.0 replace all 'control' with 'loop'. Example - <% loop Menu(1) %><% end_loop %>

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    Arvixe Web Hosting / SilverStripe Community Liaison | Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

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