21294 Posts in 5734 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » Vertical Menu problem - want level 1 and level 2 to be visible
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 873 Views |
-
Vertical Menu problem - want level 1 and level 2 to be visible

6 May 2010 at 8:49pm Last edited: 6 May 2010 9:00pm
Hello
I have a vertical menu with the level 1 pages displayed.
When you click on a page that has children it should display them.
See example.So i thought this code should do the trick, but it doesn't do anything. I'm only seeing level 1.
In page.php I have enabled children.
static $allowed_children = array('Page');
<ul>
<% control Menu(1) %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>
<% if Menu(2) %>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle.XML</a></li>
<% end_control %>
</ul>
<% end_if %>
<% end_control %>
</ul>
-
Re: Vertical Menu problem - want level 1 and level 2 to be visible

6 May 2010 at 9:08pm
Ok solved it with a bit of puzzling and the help of Sidebar.ss, but why does it need to be like this:
<ul>
<% control Menu(1) %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle.XML</span></a></li>
<% if LinkOrSection = section %>
<% control Children %>
<ul id="Menu2">
<li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle.XML</a></li>
</ul>
<% end_control %>
<% end_if %>
<% end_control %></ul>
| 873 Views | ||
|
Page:
1
|
Go to Top |

