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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   3837 Views

Avatar
Garrett

Community Member, 245 Posts

1 August 2008 at 5:11am

Hi,

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.

Thanks,
Garrett

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

http://doc.silverstripe.com/doku.php?id=built-in-page-controls#dataobjectset_options

John