Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » 2 Level Menu Hierarchy

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2209 Views
  • Danielku15
    Community Member
    1 Post

    2 Level Menu Hierarchy Link to this post

    I want to create a 2 level menu hierarchy in my template. My site structure is like this:
    * Tutorials
    + Web Development
    - PHP
    - ASP
    + Desktop Development
    - C#
    - Java

    And if I navigate to the Tutorials page. I want to show a menu Like This: (With Lists)
    Web Development
    * PHP
    * Asp
    Desktop Development
    * C#
    * Java

    I tried it like this, but I only get a parse error:

    <ul class="rightmenu_toplevel">
    <% control Menu(2) %>
    <ul class="rightmenu_secondlevel">
    <% control ChildrenOf($Link) %>
        <li><a href="$Link">$MenuTitle</a></li>
    <% end_control %>
    <% end_control %>

    Parse error: syntax error, unexpected '}' in C:\srv\temp\silverstripe-cacheD--srv-cl\.cacheD..srv.cl.tutorial.templates.Page.ss on line 214

    Any ideas?

    Greets Daniel

  • kiwifellows
    Community Member
    10 Posts

    Re: 2 Level Menu Hierarchy Link to this post


    I had some similar problems to this, but found they were fixed when I checked I had closed tags properly. For example in your code you have a "<ul class="rightmenu_toplevel"> " but no closing </ul> tag.

    I hope this helps.


  • Sam
    679 Posts

    Re: 2 Level Menu Hierarchy Link to this post

    use <% control Children %> instead of <% control ChildrenOf($Link) %>

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.