3217 Posts in 853 Topics by 812 members
| Go to End | ||
| Author | Topic: | 3581 Views |
-
Re: Help with header

7 November 2009 at 10:47am
U wanna have tab where u can change the banner image in everypage??
-
Re: Help with header

7 November 2009 at 11:14am
Thank you for the reply, I have this all working now.
-
Re: Help with header

27 November 2009 at 4:13am
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 somethingJoakim
-
Re: Help with header

27 November 2009 at 4:38am Last edited: 27 November 2009 5:16am
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... -
Re: Help with header

27 November 2009 at 6:17am Last edited: 27 November 2009 6:17am
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;
}}
-
Re: Help with header

27 November 2009 at 11:31pm
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
-
Re: Help with header

9 December 2009 at 4:01am Last edited: 9 December 2009 4:06am
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)
-
Re: Help with header

9 December 2009 at 4:51am Last edited: 9 December 2009 4:52am
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
| 3581 Views | ||
| Go to Top |





