Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » SOLVED - How to use Orientation in control <% if?

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

Page: 1
Go to End
Author Topic: 956 Views
  • dominicB
    Avatar
    Community Member
    14 Posts

    SOLVED - How to use Orientation in control <% if? Link to this post

    This is what I want to do:

    <% if ImageFile.Orientation = 2 %>
    $ImageFile.SetWidth(135)
    <% else %>
    $ImageFile.SetHeight(135)
    <% end_if %>

    I can use $ImageFile.Orientation outside if the <% %> and it prints on the screen nicely. But If I try and use it inside <% %> the template breaks.
    Do I have the wrong syntax? I've tried every variation I can think of. Or is it just not possible? I know I can get around this by adding a method into the controller but it's annoying to have to do that when I can print the Orientation property onto the page.

  • dominicB
    Avatar
    Community Member
    14 Posts

    Re: SOLVED - How to use Orientation in control <% if? Link to this post

    I found the answer here:

    http://www.silverstripe.org/template-questions/show/272774#post272774

    it's

    <% control ImageFile %>
    <% if Orientation = 2 %>
    $SetWidth(135)
    <% else %>
    $SetHeight(135)
    <% end_if %>
    <% end_control %>

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