Skip to content

Instantly share code, notes, and snippets.

@flashvnn
Created May 15, 2014 02:15
Show Gist options
  • Save flashvnn/81905a6998c38119d017 to your computer and use it in GitHub Desktop.
Save flashvnn/81905a6998c38119d017 to your computer and use it in GitHub Desktop.
Field formmater template: flexslider
<?php
/*Template Name: FlexSlider Slideshow*/
// Add js and css
drupal_add_js("sites/all/libraries/flexslider/jquery.flexslider.js");
drupal_add_css("sites/all/libraries/flexslider/flexslider.css");
//dpm($data);
?>
<!-- Place somewhere in the <body> of your page -->
<div class="flexslider">
<ul class="slides">
<?php foreach ($data as $key => $item) {
print '<li><img src="'.$item['path'].'" /></li>';
} ?>
</ul>
</div>
<style type="text/css">
.flexslider ul, .flexslider ol{
margin: 0;
padding: 0;
}
</style>
<script type="text/javascript">
(function($){
$(document).ready(function() {
$('.flexslider').flexslider();
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment