Can someone please explain how i can make the header image that changes when u change page
homepage - header 1
products - header 2
1st product group - header 3
2nd product group - header 4
and so on...
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Can someone please explain how i can make the header image that changes when u change page
homepage - header 1
products - header 2
1st product group - header 3
2nd product group - header 4
and so on...
The header area must be in cms to edit before content. i understand that i need to add some lines in page.php under mysite but dont know what kind.
Hi Webdoc
All you need to do is add an ImageField so that users can attach an image to the page. So to do that your Page class would look like this:
class Page extends SiteTree {
public static $has_one = array(
'BannerImage' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new ImageField('BannerImage', 'Banner image'),'Content');
return $fields;
}
}
Then in your template you can use $BannerImage to call the image or <% control BannerImage %>$CroppedImage(20,20).URL<% end_control %> etc. etc.
Hope that helps
Aram
almost aram but im using flash embed code so image is not right.
When you say flash embed code are you using SWFs? if so I tend to use a FileIFrameField instead of an ImageField and 'File' instead of 'Image'
but how i set the size of it
can u help with sample code please
Surely the size is set in the embed code?
basically you are going to be using the CMS to set the URL of the flash object, the size will be hard coded into the template flash code, or am I missing something?