21297 Posts in 5734 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1126 Views |
-
Diffrent Header Image For Each Page?

15 July 2009 at 6:36am
Hi
What I am after doing is have a different header image for each page so i noticed this topic http://www.silverstripe.org/template-questions/show/254016#post254016 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
Page.php
class Page extends SiteTree {
public static $db = array(
);public static $has_one = array(
);static $has_one = array (
'HeaderImage' => 'Image'
);function getCMSFields() {
$fields = parent::getCMSFields();
if(!$this->Parent){
$fields->addFieldToTab("Root.Content.Main", new ImageField('HeaderImage'));
}return $fields;
}}
page.ss
<% control Level(1) %>
$HeaderImage
<% end_control %>I seem just to get a blank white screen, I bet is something simple.
Thanks in advance
FireMe
-
Re: Diffrent Header Image For Each Page?

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.
-
Re: Diffrent Header Image For Each Page?

16 July 2009 at 4:55am
Thanks for the reply Hamish, but I still seem to be getting a white screen>
-
Re: Diffrent Header Image For Each Page?

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.
-
Re: Diffrent Header Image For Each Page?

17 July 2009 at 4:20am
the white screen is every where on the site
| 1126 Views | ||
|
Page:
1
|
Go to Top |


