<%if%>可以使用整数吗?

I'd like to use a SilverStripe 3 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 ==.

Yes, when done properly, no when you're doing it that way. 1 = means you're assigning 1 to the variable, which will always be true. 2 ='s (==) is a comparison operator. 3 (===) is a type comparison operator.

http://php.net/manual/en/language.operators.comparison.php

I would say yes. But I can't remember the last time I've done it. Looking at the doc you should be able to do: http://doc.silverstripe.org/framework/en/3.1/reference/templates

<% if $Variable.count == "10" %>
    ...
<% end_if %>

like @aynber said, make sure to use == and number (might) have to have quotes around.