Jump to:

5541 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: 1062 Views
  • webdevil
    Avatar
    Community Member
    1 Post

    Javascript header rotator Link to this post

    Hi,

    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,
    webdevil

  • theAlien
    Avatar
    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" );

    parent::init();
    }

    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

    1062 Views
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.