Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » Coding: How to Embed Menu Items?

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

Page: 1
Go to End
Author Topic: 1431 Views
  • David_Fourie
    Avatar
    Community Member
    2 Posts

    Coding: How to Embed Menu Items? Link to this post

    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

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Coding: How to Embed Menu Items? Link to this post

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

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

  • David_Fourie
    Avatar
    Community Member
    2 Posts

    Re: Coding: How to Embed Menu Items? Link to this post

    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>

    1431 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.