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.

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

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

How to set up Sub-sub-menu to my site??


Go to End


2 Posts   3215 Views

Avatar
justcomde

Community Member, 2 Posts

18 August 2009 at 3:09am

Edited: 18/08/2009 3:10am

Hello everyone,

i was asking myself how to implement a sub-sub-menu to my site. I am quite new to silverstripe and don't know how to do that.

This is how the actual sub-menu is looking:

<% if Menu(2) %>
<div id="Menu2Top">
<% control Level(1) %>
<h2><a href="$Link">$Title</a></h2>
<% end_control %>
</div>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="$Title">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>

What do i need to do?

I tried this one here, but didn't work out:

<% if Menu(2) %>
<div id="Menu2Top">
<% control Level(1) %>
<h2><a href="$Link">$Title</a></h2>
<% end_control %>
</div>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="$Title">$MenuTitle</a>
  <% if Children %> 
    <ul>
      <% control Children %> 
        <li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle</a></li>  
      <% end_control %>
</li>
<% end_control %>
</ul>
<% end_if %>

Am I missing something? Anyone got a clue how to make it work?

Thanks in advance,

m-obi

Avatar
justcomde

Community Member, 2 Posts

18 August 2009 at 3:34am

I tried a little harder and came to THE solution. For anyone who has the same problems, just do it this way:

<% if Menu(2) %>
<div id="Menu2Top">
<% control Level(1) %>
<h2><a href="$Link">$Title</a></h2>
<% end_control %>
</div>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="$Title">$MenuTitle</a>
<% if Children %>
   <ul>
      <% control Children %>
         <li class="$LinkingMode"><a href="$Link" title="$Title">$MenuTitle</a></li>
         <% if LinkOrSection = section %>
            <% if Children %>
            <% end_if %>
         <% end_if %>
      <% end_control %>
   </ul>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>