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.

Archive /

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

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

Simple Logic in Templates (Greater Than / Less Than)


Reply


2 Posts   2836 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.

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

John