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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Showing sister, brother OR children menu


Go to End


2 Posts   2579 Views

Avatar
sca123

Community Member, 61 Posts

29 July 2009 at 8:59am

Hi

I would like to be able to have a control that will display either all second level menu items under the selected parent OR all second level menu items that are sister/brother to a selected second level menu.

Any assistance would be appreciated.

Avatar
TerryMiddleton

Community Member, 108 Posts

29 July 2009 at 9:06am

Sca123,

I had the exact same issue when I first started. It's hard to get your head around how SS does the nav, but after you get it, you'll see how smart the people where at SS.

Instead of explaining I'm just going to give you my code and you can see it in action at: http://www.radimage.com

Note: I only go 3 levels deep on the menu. Also, I made the sidebar as an includes in the templates.

Hope this helps and is what you are looking for.

Terry

<CODE>

<div id="Sidebar" class="typography">
<div class="sidebarBox">

<ul id="menu">
<% control Menu(1) %> <!-- Level I -->

<li class="m$ID $LinkingMode"><a href="$Link" target="_self" class="a$ID">$MenuTitle.XML</a></li>

<!-- for expanding out the first menu -->

<% if URLSegment = rit113-imrt-qa-software %>
<% if LinkingMode = link %>
<% control Children %>
<ul id="smenu">
<li class="m$ID $LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="sa$ID">$MenuTitle</a></li>
</ul>
<% end_control %>
<% end_if %>
<% end_if %>
<!-- end for expanding out first set of menu items -->

<% if LinkOrSection = section %>

<% if Children %>
<% control Children %>
<ul id="smenu">
<li class="sm$ID $LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="sa$ID">$MenuTitle</a></li>
<% if LinkOrSection = section %>
<% if Children %>
<ul id="ssmenu">
<% control Children %>
<li class="ssm$ID $LinkingMode"><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
<% end_if %>
</ul>
<% end_control %>
<% end_if %>
<% end_if %>
<% end_control %>
</ul>

</div>

</div>

</CODE>