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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

ImageDataObjectManager, get $width from first element


Go to End


3 Posts   1543 Views

Avatar
patte

Community Member, 63 Posts

7 January 2010 at 2:43am

Hi,

I want to get the $width property from the first Attachment.

<% if Screenshots %>
<% control Screenshots %>
	<h3>$Name</h3>
	<p>$Description</p>
	<% control Attachment %>$URL<% end_control %>
<% end_control %>
<% end_if %>

<% control Attachment %>$width<% end_control %> is working fine but returns the properties for all elements.

any idea? Thanks much!
patte

Avatar
UncleCheese

Forum Moderator, 4102 Posts

7 January 2010 at 2:52am

Why not just..

<% control Screenshots %>
<% if First %>
$Attachment.Width
<% else %>
$Attachment.URL
<% end_if %>
<% end_control %>

Avatar
patte

Community Member, 63 Posts

7 January 2010 at 2:58am

ahhh... thanks ;-)