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.

Template Questions /

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

If statement throwing a parse error, no idea why.


Go to End


2 Posts   1236 Views

Avatar
Tetragrammaton

Community Member, 10 Posts

31 July 2011 at 10:18am

I've got this section of code in my template:

<% if photoOfTheDay.Width > 450 %>
$photoOfTheDay.setWidth(450)
<% else %>
$photoOfTheDay
<% end_if %>

This seems correct syntactically to me, but I keep getting a parse error for the .ss file, and it's throwing it when it hits the <% end_if %>, saying there is an unexpected brace.

Anyone know what I'm doing wrong?

Avatar
Sphere

Community Member, 46 Posts

31 July 2011 at 10:55am

Look in the SSViewer.php, there's no > or < comparator available.
I think that's the problem you're having.

Solution is to have the controller to return a true or false, based on it's height/width.