Jump to:

3401 Posts in 979 Topics by 855 members

Template Questions

SilverStripe Forums » Template Questions » <% control something %> and output "this" inside of the control

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

Page: 1
Go to End
Author Topic: 1225 Views
  • spierala
    Avatar
    Community Member
    80 Posts

    <% control something %> and output "this" inside of the control Link to this post

    Hello all,

    i have a control in a template like this:

    <% control Images %>

    <% end_control %>

    the control iterates a list of images. each object is type of Image (standard silverstripe class)
    actually i would like to output the image like this inside the control

    <% control Images %>
    $Image
    <% end_control %>

    of course this is not working because I think I can only access properties of an object inside of a control. Image is not property of image. but can I somehow output the object itself? by using something like $this ...? i need it to say $this.SetWidth(100)

    thanks in advance,
    florian

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: <% control something %> and output "this" inside of the control Link to this post

    If you are inside that control, and each item is an image object then you don't need this. You can just do $SetWidth(100)

  • spierala
    Avatar
    Community Member
    80 Posts

    Re: <% control something %> and output "this" inside of the control Link to this post

    thanx Willr!
    worked fine.

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