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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Simple Logic in Templates (Greater Than / Less Than)

Go to End

2 Posts   3585 Views


Community Member, 245 Posts

1 August 2008 at 5:11am


Can I compare two integers in a template? Want to check the position in a control Children loop. I.e.: <% if(Pos < 6) %>. That kind of thing. I can get away with <% if(Pos = 6) %> but the greater than and less than breaks it. How can I compare? Can't find syntax for this anywhere.


BLU42 Media

Community Member, 71 Posts

1 August 2008 at 7:19am

Hi Garrett-

There's no support (yet, anyway) for greater/less than comparisons, but you could try checking the position with the $Pos variable in the template.