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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Diffrent Header Image For Each Page?

Go to End

5 Posts   1731 Views


Community Member, 74 Posts

15 July 2009 at 6:36am

What I am after doing is have a different header image for each page so i noticed this topic and Aram has put a post of a good way to do it but i can not seem to get it to work, Aram can you help me :-)

Here is the code


class Page extends SiteTree {
   public static $db = array(
   public static $has_one = array(

static $has_one = array (
'HeaderImage' => 'Image'

function getCMSFields() {

$fields = parent::getCMSFields();

$fields->addFieldToTab("Root.Content.Main", new ImageField('HeaderImage'));

return $fields;


<% control Level(1) %>
<% end_control %> 

I seem just to get a blank white screen, I bet is something simple.

Thanks in advance



Community Member, 712 Posts

15 July 2009 at 9:04am

The control statement takes you out of the current page. Remove the control and leave the $HeaderImage - should work fine.


Community Member, 74 Posts

16 July 2009 at 4:55am

Thanks for the reply Hamish, but I still seem to be getting a white screen> :-(


Community Member, 145 Posts

16 July 2009 at 2:42pm

Where are you getting a white screen? In the admin?

I don't know if SS will have an issue with it, but your defining has_one twice.


Community Member, 74 Posts

17 July 2009 at 4:20am

the white screen is every where on the site