23379 Posts in 18298 Topics by 2867 members
|Go to End|
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?
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) %>
<% control Menu(2) %>
<a href="$Link" class="$LinkingMode" title="Go to '$MenuTitle.XML'">$MenuTitle.XML</a>
<% end_control %>
<% 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...
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!
|Go to Top|