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

Show complete menu system in footer


Go to End


3 Posts   1835 Views

Avatar
doubleedesign

Community Member, 19 Posts

6 October 2010 at 11:02am

Hi all,

I'm new at SilverStripe but am liking it a lot so far. I've got a 2-level navigation system going fairly easily as per the basic site tutorial, ie. the section names are the first level and then as you open those pages, the second level menu appears.

I'd like to show the complete menu system in the footer as well, eg. several columns with a first-level link at the top of each column and then the relevant second-level links below it. Eg. Say I had 3 first-level links, Home, About and News. And within About was Our History, Staff and Locate Us. In the footer, Home About Us and News would be along the top, and then History, Staff and Locate Us would be below About Us.

I've tried searching the forums but haven't been able to work out how to do it. Any suggestions would be most appreciated.

Avatar
Willr

Forum Moderator, 5523 Posts

6 October 2010 at 8:22pm

Well if you want columns of all the pages then its quite simple, just loop over the top level menu and for each item display the children.

Note to make it shorter I have left out the list item html you should use as well.

<% control Menu(1) %>
<div class="column">
<a href="$Link">$MenuTitle</a>

<% control Children %>
<a href="$Link">$MenuTitle</a>
<% end_control %>
</div>

Avatar
doubleedesign

Community Member, 19 Posts

7 October 2010 at 12:46pm

Thanks Willr, that should be better than what I ended up coming up with, which was too specific in terms of the level 1 links and had to use a table:

<table>
<tr>
<% control Menu(1) %>
<th>
<a class="$LinkingMode" href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a>
</th>
<% end_control %>
</tr>
<tr>
<td>
<% control ChildrenOf(level-1-link-1 %>
<li class="$LinkingMode"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a></li>
<% end_control %>
</td>
<td>
<% control ChildrenOf(level-1-link-2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a></li>
<% end_control %>
</td>
</tr>
</table>