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.

General Questions /

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

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

Image Control in a Style Artibute


Go to End


2 Posts   1107 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!