sktzoootech / cycle-carousel

Cycle Carousel is a simple SilverStripe module. The modules uses Cycle2 JQuery Plugin by malsup.
0 stars 3 forks source link

Cycle Carousel Silverstripe Module

Introduction

This module is a simple carousel module that uses Cycle2 JQuery plugin by malsup. To know more about the Cycle2

Installation

After downloading, copy this module to your project folder and do a /dev/build?flush=all.

You can also use composer to add this module to your project using the following:

composer require "skTzoooTech/cycle-carousel:*"

But before adding the above module make sure you add sktzoootech/link-field and other modules (Please see composer.json for all dependecy):

composer require "skTzoooTech/link-field:*"

composer require "ajshort/silverstripe-gridfieldextensions:*"

composer require "undefinedoffset/sortablegridfield:*"

How to use the module

The module requires JQuery so you need to add jquery to your Page_Controller class.
Make sure JQuery isn't added by any other module or else it might not work properly. To add jquery to your Page_Controller class, add the following to the init method (see example below) :


    public function init() {
        parent::init();

    Requirements::javascript(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.min.js');

  }

You can display the carousel to any of your templates. For example if you want to add the carousel to your Layout/Page.ss file, add the following to the template:


  $CycleCarouselObject

There are heaps of configuration you can apply to the carousel. All can be set in the template by putting specific "data-cycle" value. If you wish to customize the template, copy the CarouselTemplate.ss file to your themes template/Include folder. Follow the documentation found in malsups website