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.

General Questions

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

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

How To create 2. Layer in the Menu


Reply

5 Posts   1658 Views

Avatar
stooni

25 December 2008 at 4:48am Community Member, 89 Posts

How to create a second Layer in the Home Menu / Top Menu ca. for Sitemap, Contact, ... how can create with the silverstripe functionality?

Thanks for help?

---Stooni!

Avatar
Liam

25 December 2008 at 5:26am Community Member, 470 Posts

Not sure exactly what you mean by 2nd layer.

Do you want like a suckerfish/drop down navigation?

If so, this code below works for me. Make some minor adjustments to the html as I setup mine to use images for the nav, and thus need some extra code.

<ul id="nav">
<% control Menu(1) %>
<% if Children %>
   <li id="nav-$URLSegment"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div>
   <ul>
<% control Children %>
   <li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></li>
<% end_control %>
</ul>
</li>
<% else %>
   <li id="nav-$URLSegment"><div><a href="$Link" title="Go to the $Title.XML page">$MenuTitle</a></div></li>
<% end_if %>
<% end_control %>
</ul>

Avatar
stooni

29 December 2008 at 11:56pm (Last edited: 29 December 2008 11:57pm), Community Member, 89 Posts

these way show me every 2. Layer in the menu i mean these way see, the attachment!

Attached Files
Avatar
bunheng

5 October 2010 at 9:41pm Community Member, 78 Posts

Bunheng

I am having the same trouble, to create additional navigation on my website, it would be helpful if some one can solve this problem.

Thanks

Avatar
Devlin

5 October 2010 at 11:44pm Community Member, 215 Posts

Well, it's pretty simple.
Create a new Page, name it something like 'header-menu' and make sure 'Show in Menus' & 'Show in Search' is disabled. Insert all the pages you want in this Page(-Holder).
After this you go to your template and build a second menu. Something like:

<% if ChildrenOf(header-menu) %>
<ul id="header-menu" class="level_1">
   <% control ChildrenOf(header-menu) %>
   <li class="$FirstLast"><a href="$Link" title="$Title">$MenuTitle</a></li>
   <% end_control %>
</ul>
<% end_if %>