Jump to:

3392 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » If statement throwing a parse error, no idea why.

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

Page: 1
Go to End
Author Topic: 519 Views
  • Tetragrammaton
    Avatar
    Community Member
    10 Posts

    If statement throwing a parse error, no idea why. Link to this post

    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?

  • Sphere
    Avatar
    Community Member
    44 Posts

    Re: If statement throwing a parse error, no idea why. Link to this post

    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.

    519 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.