Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » how to make final if/then statement just a comment and not output?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 546 Views
  • Hello_electro
    Avatar
    Community Member
    80 Posts

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

    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!

    546 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.