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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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


890 Views

Avatar
Hello_electro

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 %>
$food
<% else_if category == cheese %>
$food
<% 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!