Jump to:

3431 Posts in 1025 Topics by 864 members

Template Questions

SilverStripe Forums » Template Questions » Can <% if %> Use Integers?

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

Page: 1
Go to End
Author Topic: 309 Views
  • BobRock
    Avatar
    Community Member
    15 Posts

    Can <% if %> Use Integers? Link to this post

    I'd like to use a template conditional based on an integer return like this:

    <% if $Variable.count = 1 %>

    Is that possible? It doesn't seem to work when I try it and the documentation talks only about literals inside "" with ==.

    Bob

  • BobRock
    Avatar
    Community Member
    15 Posts

    Re: Can <% if %> Use Integers? Link to this post

    With some help from Stack Overflow, the answer is yes, but you have to do it right:

    <% if $Variable.count == 1 %>

    Note that that's two =.

    Bob

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