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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Need Image link without the 'img src' tag


Reply

2 Posts   688 Views

Avatar
Snowlord

8 December 2011 at 12:39pm Community Member, 6 Posts

I'm trying to add the ability to insert an image into the background of a div. I have my CSS:

-----------
<style type="text/css">
   .mainBackground {
   background: #000 url('$BackgroundImage') no-repeat left top;
   }
   </style>
-----------

And added the proper tab into the php page:

-----------
$fields->addFieldToTab("Root.Content.Images", new ImageUploadField('BackgroundImage', 'Background Image'));
-----------

Everything functions as expected EXCEPT, it adds in the '<img src' tag (as it should). Is there a way to have the same functionality, only JUST insert the actual image path WITHOUT the 'img src' tag or the 'alt' tag?

Thanks!

Avatar
UncleCheese

10 December 2011 at 4:12am 4085 Posts

$BackgroundImage.URL

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com