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   1700 Views

Avatar
stooni

Community Member, 89 Posts

25 December 2008 at 4:48am

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

Community Member, 470 Posts

25 December 2008 at 5:26am

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

Community Member, 89 Posts

29 December 2008 at 11:56pm

Edited: 29/12/2008 11:57pm

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

Attached Files
Avatar
bunheng

Community Member, 78 Posts

5 October 2010 at 9:41pm

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

Community Member, 225 Posts

5 October 2010 at 11:44pm

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 %>