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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Image Control in a Style Artibute


2 Posts   686 Views


12 January 2011 at 4:53am (Last edited: 12 January 2011 4:54am), Community Member, 60 Posts

Hey guys.

Looking for some help here.

I have the following code in a template file. You can see that I want to add an image into the 'style' attribute of a div tag (the below code doesnt work). But I need this to be controlled from the CMS. I can't just put it into the div because, as you can see I need another image layering over it. Is there a way to do this?

<div id="featureImage" class="grid_10 alpha" style="background: #fff url($FeaturePhoto.SetWidth(614)) no-repeat;">
<img src="themes/blackcandy/images/featureBorder.png" align="right"/>

Any help would be appreciated.



12 January 2011 at 5:35am Community Member, 60 Posts

It's fine. I found out how to do this:

<div id="featureImage" class="grid_10 alpha" style="background: #fff url($FeaturePhoto.URL) no-repeat;">
<img src="themes/blackcandy/images/featureBorder.png" align="right"/>