4572 Posts in 1316 Topics by 981 members
Customising the CMS
SilverStripe Forums » Customising the CMS » Nested menus
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1396 Views |
-
Nested menus

1 November 2009 at 5:46am Last edited: 1 November 2009 5:47am
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??
-
Re: Nested menus

1 November 2009 at 7:11am
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 %>
-
Re: Nested menus

1 November 2009 at 7:52am
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?
-
Re: Nested menus

3 November 2009 at 7:46pm
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.
| 1396 Views | ||
|
Page:
1
|
Go to Top |


