21307 Posts in 5737 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 560 Views |
-
menu control

10 March 2011 at 11:27pm
Hi to all,
I have completed my first SilverStripe project and must say, I love the way it works. I am now starting my second approach which is a bit less standard. So I hope to get some help in how to go for this one. The problem is as follows:
The menu level1 is horizontal. No troubles so far. It includes eight categories. My problem now is, that the submenus of the first three categories should behave differently than the rest. How do I address those single categories, so I can manage this via an if-else construction?
Samy
-
Re: menu control

11 March 2011 at 1:09am Last edited: 11 March 2011 1:10am
You could add a special class to each submenu, based on its position in the main menu ($Pos) or its urlsegent ($URLSegment ). Something like:
<% if Menu(2) %>
<ul class="menuType{$Pos}">
<% control Menu(2) %>
<li>
<a href="$Link" class="$LinkingMode" title="Go to '$MenuTitle.XML'">$MenuTitle.XML</a>
</li>
<% end_control %>
</ul>
<% end_if %>Or, if you want it more dynamic, add a new database field to the page, update it from the backend and use that to name the class...
-
Re: menu control

11 March 2011 at 2:26am
That looks exactly like what I need. $Pos gives me access to the single parent categories... I will try and report.
Thanks a lot!Samy
| 560 Views | ||
|
Page:
1
|
Go to Top |
