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   1301 Views

Avatar
spierala

Community Member, 80 Posts

24 March 2010 at 1:27am

Edited: 24/03/2010 3:17am

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

Forum Moderator, 5513 Posts

24 March 2010 at 9:30am

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

Community Member, 80 Posts

25 March 2010 at 9:58pm

thanx Willr!
worked fine.