function loadSliderFromJsonFileName($fileName) { $JsonPath = "experiments/" . $fileName; $pagesJson = file_get_contents($JsonPath); $pagesArray = json_decode($pagesJson, true); if (array_key_exists('slideInterval', $pagesArray)) { echo "<div class='container'><div id='myCarousel' class='carousel-fade' data-ride='carousel' data-interval='" . $pagesArray['slideInterval'] . "' data-pause='false'><div class='carousel-inner' role='listbox'>"; } else { echo "<div class='container'>\n<div id='myCarousel' class='carousel-fade' data-ride='carousel' data-interval='2000' data-pause='false'>\n<div class='carousel-inner' role='listbox'>"; } foreach ($pagesArray as $pageNum => $jsonString) { if ($pageNum == 'slideInterval') { } else { displaySlide($pageNum, $jsonString); } } echo "</div>\n</div>\n</div>"; }
<?php $slides = array_slice($json['Results'], 3, 3, true); foreach ($slides as $i => $slide) { displaySlide($slide); } ?> </div> <div class="item row"> <?php $slides = array_slice($json['Results'], 6, 3, true); foreach ($slides as $i => $slide) { displaySlide($slide); } ?> </div> </div> <!-- Controls --> <a class="left carousel-control" href="#frontpage_properties_carousel" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#frontpage_properties_carousel" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a>