Jump to:

23478 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Specific value IF statement

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

Page: 1
Go to End
Author Topic: 700 Views
  • kevino
    Avatar
    Community Member
    30 Posts

    Specific value IF statement Link to this post

    I want to be able to make an IF statement based on the value of the field entered in the cms.
    The field I have is a drop down, so it's controllable to an extent.

    I currently have a filedataobjectmanager where one of the values is a catogory.
    I've then got a jqury filtering system setup where the files are filtered by download categories.

    What I want to acheive is to only show the filter button for file types which are there, so I never have an empty area.

    I'm thinking something along these lines:

    <ul id="downloads-menu">
       <li class="title">Select Type</li>
          <li class="current"><a href="#nogo">All</a></li>
          <% if Category(financial-information) %><li><a href="#nogo">Financial Information</a></li><% end_if %>
          <% if Category(management-information) %><li><a href="#nogo">Management Information</a></li><% end_if %>
          <% if Category(uk-specific) %><li><a href="#nogo">UK Specific</a></li><% end_if %>
          ...etc
    </ul>

    How would I acheive this. I know "<% if Category(uk-specific) %>" doesn't work - but what will?

    Cheers!

    700 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.