Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Javascript header rotator

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

Page: 1
Go to End
Author Topic: 1059 Views
  • webdevil
    Community Member
    1 Post

    Javascript header rotator Link to this post


    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,

  • theAlien
    Community Member
    131 Posts

    Re: Javascript header rotator Link to this post

    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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.