Skip to content

Instantly share code, notes, and snippets.

@unclecheese
Created August 23, 2017 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unclecheese/2ce2238f7ee7167cd9ed47c294b04e05 to your computer and use it in GitHub Desktop.
Save unclecheese/2ce2238f7ee7167cd9ed47c294b04e05 to your computer and use it in GitHub Desktop.
const slides = JSON.parse($('body').data('slides'));
$('body').vegas({
delay: 3000,
timer: false,
slides
});
<?php
class YourPage extends Page
{
private static $has_one = [
'Slideshow1' => 'Image',
'Slideshow2' => 'Image',
// etc..
];
public function getCMSFields()
{
//....
}
public function getSlideURLs()
{
return Convert::array2json(array_map(function($num) {
return $this->{'Slideshow'.$num}()->URL;
}, range(1, 6)));
}
}
class YourPage_Controller extends Page_Controller
{
}
<body data-slides="$SlideURLs">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment