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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

how to make final if/then statement just a comment and not output?

Go to End



Community Member, 80 Posts

30 March 2011 at 8:52am

If I am using the DOM and lets say I have two categories for $food (meats and cheese) that i can choose with each food item i pick.

I want to create something like this:

<% control TypesofFood %>
<% if category == meat %>
<% else_if category == cheese %>
<% else %>
You aint got no meat or cheese!
<% end_if %>
<% end_control %>

my problem that if SS makes it all the way through the argument and gets to "You aint got no meat or cheese!" it will repeat this for as many times as their are Dataobjects.

Anyone know how I get that last statement to just appear once?? Thanks!