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

Cannot Reference Banner Image more than Once


5 Posts   1029 Views


3 September 2010 at 4:36am Community Member, 3 Posts

*** newbie/noob question (sorry) ***

I have extended SiteTree in my Page.php to provide support for banner images on pages within my site - and this works as intended, for example:

class Page extends SiteTree {

public static $db = array(

public static $has_one = array(
'BannerImage' => 'Page_BannerImage',

function getCMSFields() {
$fields = parent::getCMSFields();
$fields ->addFieldsToTab(
new ImageField('BannerImage', 'Banner')

return $fields;


function getBannerImageRecursive() {
$page = $this;
$banner = $this->BannerImage();
while(!$banner->ID && $page->ParentID !=0) {
$page = $page->Parent();
$banner = $page->BannerImage();

return $banner;


The obstacle I have encountered is that once an image is selected from the File Store and attached to a page, that image is no longer referenced in the File Store list and cannot (apparently) be used as an attachment for another page. Yes, I know that I can attach an image from my file system (workaround?) yet, I am looking for a method that continues to enumerate the files/images on the File Store list.

Any ideas???


4 September 2010 at 1:30am (Last edited: 4 September 2010 1:30am), Community Member, 135 Posts

I'm also having this problem a lot. I tend to use the Image DataObjectManager instead.


4 September 2010 at 2:16am Community Member, 3 Posts

dendeffe - Thanks for the tip on an alternative method! Now, (and since I am a novice here) would you explain how I might go about implementing the Image DataObjectManager class? Or at least point me to some explanatory documentation? - thanks in advance.


4 September 2010 at 2:39am Community Member, 135 Posts

It’s part of the Data Object Manager extension:

which has pretty good documentation.

You can also check out UncleCheese’s (who develops it) screencast:


4 September 2010 at 2:42am Community Member, 3 Posts

Thank you! I will evaluate this alternative and let you (and everyone in the forum) know how it turns out!