Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Image Control in a Style Artibute

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

Page: 1
Go to End
Author Topic: 667 Views
  • MagicUK
    Avatar
    Community Member
    60 Posts

    Image Control in a Style Artibute Link to this post

    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!

  • MagicUK
    Avatar
    Community Member
    60 Posts

    Re: Image Control in a Style Artibute Link to this post

    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!

    667 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.