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.

Template Questions

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


Reply

3 Posts   1266 Views

Avatar
spierala

24 March 2010 at 1:27am (Last edited: 24 March 2010 3:17am), Community Member, 80 Posts

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

Avatar
Willr

24 March 2010 at 9:30am Forum Moderator, 5511 Posts

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)

Avatar
spierala

25 March 2010 at 9:58pm Community Member, 80 Posts

thanx Willr!
worked fine.