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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

If statement help


Reply


3 Posts   483 Views

Avatar
lozhowlett

Community Member, 146 Posts

15 September 2012 at 2:54am

Guys

this is probably stupidly simple, but how do I do something different based on what menu item I am in, within the loop.

Basically the recipes drop down is going to be a "mega menu" where as the rest are just normal drop downs.

I cant think how to get around this with built in template controls! Help!

<% control Menu(1) %>   
<% if Children %>
<% if $MenuTitle="Recipes" %>

<% else %>
<li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle.XML</a>
<ul class="dropdown1">
<% control Children %>
<li><a href="$Link">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
<% else %>
<li><a href="$Link" title="Go to the $Title.XML page">$MenuTitle.XML</a>
<% end_if %>
</li>
<% end_control %>

Avatar
lozhowlett

Community Member, 146 Posts

18 September 2012 at 1:48am

*bump*

Avatar
martimiz

Forum Moderator, 1132 Posts

18 September 2012 at 3:31am

Edited: 18/09/2012 3:31am

Basically <% if $MenuTitle="Recipes" %>, like in your example, should work - if you're at version 3.0.x that is. In 2.4 it should be <% if MenuTitle = Recipes %>...

But maybe I didn't understand you correctly, and you want to know howto create that megadropdown?