public function beforeRender() { parent::beforeRender(); Requirements::css(NivoSlider::get_module_folder() . '/themes/light/light.css'); }
/** * Render the Nivo Slider * * @return string HTML **/ public function forTemplate() { $classes = array_reverse(ClassInfo::ancestry($this->ClassName)); $baseClass = ClassInfo::baseDataClass($this->ClassName); $templates = array(); foreach ($classes as $class) { $templates[] = $class; if ($class == $baseClass) { break; } } // Require nivo slider assets Requirements::css(NivoSlider::get_module_folder() . '/css/nivo-slider.css'); Requirements::javascript(NivoSlider::get_module_folder() . '/javascript/jquery-1.9.0.min.js'); Requirements::javascript(NivoSlider::get_module_folder() . '/javascript/jquery.nivo.slider.pack.js'); Requirements::customScript('$(window).ready(function() { $("#' . $this->ClassName . '-' . $this->ID . '").nivoSlider({ effect: "' . $this->Effect . '", animSpeed: ' . $this->AnimationSpeed . ', pauseTime: ' . $this->PauseTime . ', startSlide: ' . $this->StartSlide . ', slices: ' . $this->Slices . ', boxCols: ' . $this->BoxCols . ', boxRwos: ' . $this->BoxRows . ', directionNav: ' . $this->DirectionNav . ', controlNav: ' . $this->ControlNav . ', controlNavThumbs: ' . $this->ControlNavThumbs . ', pauseOnHover: ' . $this->PauseOnHover . ', manualAdvance: ' . $this->ManualAdvance . ', prevText: "' . $this->PrevText . '", nextText: "' . $this->NextText . '", randomStart: ' . $this->RandomStart . ' }); });'); // Setup our theme $theme = new $this->Theme(); $theme->beforeRender(); return $this->customise(array("ThemeTitle" => $theme->getTitle(), "ThemeCSSClass" => $theme->getCssClass()))->renderWith($templates); }
public function beforeRender() { parent::beforeRender(); Requirements::css(NivoSlider::get_module_folder() . "/themes/default/default.css"); }
<?php include "nivoslider.php"; $nivo = new NivoSlider('nivoslider', 618, 200); // base path is same directory //$nivo->add_slide(ImagePath,URL,Caption); $nivo->add_slide('Gambar_Slider/1.jpg', '', ''); $nivo->add_slide('Gambar_Slider/2.jpg', '', ''); $nivo->add_slide('Gambar_Slider/3.jpg', '', ''); ?> <?php $nivo->render_includes(); $nivo->render_slides();
public function updateCMSFields(FieldList $fields) { $fields->insertBefore(DropdownField::create("NivoSliderID", "Nivo Slider", NivoSlider::get()->map()), "Content"); }