PHP code example of bociancz / slider-module
1. Go to this page and download the library: Download bociancz/slider-module library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bociancz / slider-module example snippets
{-- Themes/MyTheme/views/slider/my-own-slider.blade.php --}
<div id="{{ $slider->system_name }}" class="my-own-slider-class">
@foreach($slider->slides as $index => $slide)
<div class="slide">
<a href="{{ $slide->getLinkUrl() }}">
<img src="{{ $slide->getImageUrl() }}" />
</a>
</div>
@endforeach
</div>
...
// import classes needed to create your own instance
use Modules\Slider\Entities\Slider;
use Modules\Slider\Entities\Slide;
class HomepageController {
...
/**
* controller method
*/
public function displayHomepage()
{
// make a new Slider instance
$mySlider = new Slider;
$mySlider ->system_name = 'custom_slider';
// create slide 1
$slide1 = new Slide;
$slide1->title = 'First Slide';
$slide1->caption = 'First slide text';
$slide1->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Slide1&w=800&h=300';
// create slide 2
$slide2 = new Slide;
$slide2->title = 'Second Slide';
$slide2->caption = 'Second slide text';
$slide2->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Slide2&w=800&h=300';
// add slides to slider
$mySlider->slides->add($slide1);
$mySlider->slides->add($slide2);
// render view
return View::make('homepage')
->with('mySlider', $mySlider);
}
'slide-images' => [
'slideImage',
]
'slide-images' => [
'slideImage',
'slideImage_hover',
'slideImage_alternative',
]