U wanna have tab where u can change the banner image in everypage??
We've moved the forum!
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.
- Previous 10 entries
- 1
- 2
- Page 33(current)
Thank you for the reply, I have this all working now.
Hi used the
public static $has_one = array(
'FlashBanner1' => 'File'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Banner', new FileIFrameField('FlashBanner1'));
return $fields;
}
}
in mysite/code/page.php
but when i try to acccess the cms i get website error. Have I missed something
Joakim
What error?
I got a cant handle suburls when using SiteTree::enable_nested_urls(); in 2.4.
Diable the nested urls made the uploadfield work again.
Edit:: this is nog a nested_urls related error, but a translatable error...
This is my code in the code>Page.php file
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
"HeaderImage" => "Image"
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new ImageField("HeaderImage", "Header Image"));
return $fields;
}
}
I used the same code but still an error. I checked the error log on the server and it said that the editor.css was missing, so I took it from the blackcandy template and moved it over to the server but still the same error?
Joakim
Hello Aram,
You tip on the unique header image for pages has really help me alot. In continuation of puting unique Image or Flash header, I will really appreciate if you can help me with how i can upload not just 1 image but multiple images for each page and use the images in a with this javascript image slider: http://www.gruppo4.com/~tobia/cross-slide.shtml (CrossSlide is a jQuery plugin for image animation slideshow)
I have tried to use the javascript code directly inside the template but didn't work, the image or how i can use it directly with the image gallery module which seems like further maths to me, very dificult. I have very new with SilverStripe, great product.
What i want to achieve is unique/ different Image slideshow on the Header of my pages, the diffrent pages will have diffrent image header slider.
Please any help will be appreciated from you guys, expecially with using the CrossSlide javascript image slider: http://www.gruppo4.com/~tobia/cross-slide.shtml (Ken Burns effect)
Hi Crisazuka
This plugin seems to be a bit unconventional in that it defines the image locations within the script itself...not really a great way to do it but anyway.....
To get it to work you will need to define the script from within the init() function of your Page_Controller class. You can then get the URLs of the images you have defined in the $has_one relationship.
e.g.:
public function init() {
parent::init();
Requirements::javascript("http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js");
Requirements::javascript("mysite/javascript/jquery.cross-slide.js");
Requirements::customScript("
jQuery('#test1').crossSlide({
speed: 45,
fade: 1
}, [
{ src: '" . $this->Image1()->URL . "', dir: 'up' },
{ src: '" . $this->Image2()->URL . "', dir: 'down' },
{ src: '" . $this->Image3()->URL . "', dir: 'up' },
{ src: '" . $this->Image4()->URL . "', dir: 'down' }
]);
");
}
}
To make it work with a $has_many relationship (i.e. an Image Dataobject manager) would be a little more complicated, basically you would need to create a loop to loop through each of the images and define the path which given the structure of the definition isn't immediately obvious, I think you would need to generate the definition with a function and then insert it into the page....probably more hassle than it's worth :)
Anyway I hope that helps
Aram
- Previous 10 entries
- 1
- 2
- Page 33(current)