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


Reply


2 Posts   722 Views

Avatar
MagicUK

Community Member, 60 Posts

12 January 2011 at 4:53am

Edited: 12/01/2011 4:54am

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"/>
</div>

Any help would be appreciated.

Thanks!

Avatar
MagicUK

Community Member, 60 Posts

12 January 2011 at 5:35am

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"/>
</div>

Sorry!