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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

Menu with parent and child pages always showing


Go to End


4 Posts   3139 Views

Avatar
jloafs

Community Member, 15 Posts

23 January 2011 at 2:08pm

I'm a total SS newb and a graphic designer by trade so I'm a touch out of my depth – trying to pick it up as I go along.

I'm trying to build a site navigation that works like this example: http://www.everythingdesign.co.nz/test/la-cigale/

I need to have the Main pages and subpages always visible. I've been through the initial tutorials and got to the stage where I have a submenu appearing on the parent pages but I need to weave the two menus together and keep them visible.

The way I constructed the example menu above was to put each group of 'Main and sub menu' in a div of its own so that I could use the bottom border in css to seperate them. There may be a better way to do that too.

Can anybody help?
Cheers.

Avatar
Willr

Forum Moderator, 5523 Posts

23 January 2011 at 5:12pm

Could you post the code you've used for so far? If you want to whole submenu shown of each main level menu then you can do something like

<% control Menu(1) %>
<a href="$Link">$MenuTitle</a>
<% control Children %>
<a href="$Link">$MenuTitle</a>
<% end_control %>
<% end_control %>

http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls has all the information about the available controls.

Avatar
jloafs

Community Member, 15 Posts

23 January 2011 at 7:34pm

Thanks Willr.

Definitely getting there with your code.

At the moment I've got:

<div id="left">
<div class="menu">
<% control Menu(1) %>
<a class="menu bold" href="$Link">$MenuTitle</a>
<% control Children %>
<a class="menu" href="$Link">$MenuTitle</a>
<% end_control %>
<% end_control %>

</div>
</div>

I just need to organise each grouping into seperate divs somehow. Again, any ideas would be much appreciated.

Thanks.

Avatar
jloafs

Community Member, 15 Posts

23 January 2011 at 8:26pm

Actually, just got it.

Fantastic.

Thanks for your help.