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.

Archive /

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

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

2 Level Menu Hierarchy


Go to End


3 Posts   2807 Views

Avatar
Danielku15

Community Member, 1 Post

13 May 2008 at 2:17am

Hi.
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) %>
<li>$MenuTitle</li>
<ul class="rightmenu_secondlevel">
<% control ChildrenOf($Link) %>
<li><a href="$Link">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_control %>

Error:
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

Avatar
kiwifellows

Community Member, 10 Posts

13 May 2008 at 5:47am

Hi,

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.

Ben
http://www.fullgospel.org.nz/

Avatar
Sam

Administrator, 690 Posts

13 May 2008 at 1:37pm

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