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.

Template Questions /

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

Coding: How to Embed Menu Items?


Go to End


3 Posts   2440 Views

Avatar
David_Fourie

Community Member, 2 Posts

21 March 2009 at 1:41am

Hi,

This should be possible to do:
<ul>
<li> Item one </li>
<ul>
<li> Sub-Item One <li>
<ul>
<li> Sub-Sub-Item One </li>
</ul>
</ul>
<li> Item two </li>
</ul>

Please can anyone look and make suggestions on what I've already worked on:

<% if Menu(1) %>
<ul>
<% control Menu(1) %>
<li>
<a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle
<!--[if IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<% if Menu(2) %>
<ul>
<% control Menu(2) %>
<li>
<a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle
<!--[if IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<% if Menu(3) %>
<ul>
<% control Menu(3) %>
<li>
<a class="drop" href="$Link" title="Go to the $Title page">$MenuTitle
<!--[if IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
</li>
<% end_control %>
</ul>
<% end_if %>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<% end_control %>
</ul>
<% end_if %>
</a>
</li>
<% end_control %>
</ul>
<% end_if %>

It's for a CSS-only Dropdown Menu to level 3.

Thanks
David

Avatar
Fuzz10

Community Member, 791 Posts

21 March 2009 at 2:15am

Bit of a nasty hack , but this page should help you :

http://doc.silverstripe.com/doku.php?id=tutorial:site-map&s=sitemap

Avatar
David_Fourie

Community Member, 2 Posts

21 March 2009 at 3:25am

Thanks! This worked:

<div class="menu">
<ul>
<% control Menu(1) %>
<li>
<a href="$Link" title="Go to the $Title page" class="$LinkingMode">$Title<!--[if IE 7]><!--></a><!--<![endif]-->
<% if Children %>
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<% control Children %>
<li>
<a href="$Link" title="Go to the $Title page" class="drop">$Title<!--[if IE 7]><!--></a><!--<![endif]-->
<% if Children %>
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<% control Children %>
<li>
<a href="$Link" title="Go to the $Title page" class="left">$Title
</li>
<% end_control %>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
<% end_if %>
</li>
<% end_control %>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
<% end_if %>
</li>
<% end_control %>
</ul>
</div>