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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

SS3: gallery and slider


3 Posts   675 Views


27 July 2012 at 9:50pm (Last edited: 27 July 2012 10:03pm), Community Member, 5 Posts

Is there a gallery module or any module for making a slider? I really need a slider and a gallery to my site. Help, please!


27 July 2012 at 10:53pm (Last edited: 27 July 2012 10:55pm), Community Member, 58 Posts


Build yourself slider and a gallery - you can better customize it for your requirements.
I usually use the slider: bxSlider,
To the gallery: fancybox,

For example to gallery use:

class Gallery extends DataObject
static $db = array (


static $has_one = array (
   'Photo' => 'Image',
'HomePage' => 'HomePage' //Page where the gallery will be available
   function getCMSFields() {
return new FieldSet(
new UploadField('Photo')

And in Page from has_many (in my example HomePage)

class HomePage extends Page {


static $many_many = array(
'Gallerys' => 'Image'

public function getCMSFields() {
   $fields = parent::getCMSFields();


      $fields->addFieldToTab('Root.Gallery', new UploadField('Gallerys', 'Gallery'));
return $fields;   

class HomePage_Controller extends Page_Controller {   
    public function init() {

      Requirements::javascript("mysite/javascript/option.bxSlider.js"); //option for bxslider

in template use

<% loop Gallerys %>
   <a rel="gallery" href="$URL">$SetWidth(80)</a>
<% end_loop %>

Sorry for my bad English


28 July 2012 at 2:22am Community Member, 5 Posts

Thank you, Craftnet!
Unfortunately, I'm not a PHP programmer, but I'll try your method.