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.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Javascript header rotator

Go to End

2 Posts   1449 Views


Community Member, 1 Post

21 March 2009 at 10:17am


i'm new with SilverStripe and i'm trying to find answer for my simple question. I'm trying to find out how to do header rotator - for example how to upload 5 images for each page and rotating it by jquery in some interval. Javascript part it isn't a problem.

Please, if it possible, give me some clues how to do it.

Thanks in advance,


Community Member, 131 Posts

21 March 2009 at 2:06pm

First of all: create some image-columns in your db. (tutorial 2)
Second: add fieldtypes to the tab of your choice. (idem)
Third: use your js-knowledge (which I haven't) to create the header-rotator and call the images from the db. Just save this javascript into a regular .js-file
Fourth: Call the .js-file in the controllerpart of your .php-file:

function init() {
      Requirements::javascript( "pathTo/myJSfile.js" );


If you need some libs like jquery, you can include them in the same way.
However: be aware that silverstripe might use the prototype and/or behaviour libs in the frontend. These might conflict and in that case you have to turn a lib off with Requirements::block("pathTo/conflictingLib.js");

Hope this helps