Blame view

js/jsor-jcarousel-7bb2e0a/examples/dynamic_ajax_php.php 1.18 KB
42868d70   andryeyev   Создал GIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  <?php
  
  // Array indexes are 0-based, jCarousel positions are 1-based.
  $first = max(0, intval($_GET['first']) - 1);
  $last  = max($first + 1, intval($_GET['last']) - 1);
  
  $length = $last - $first + 1;
  
  // ---
  
  $images = array(
      'http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg',
      'http://static.flickr.com/75/199481072_b4a0d09597_s.jpg',
      'http://static.flickr.com/57/199481087_33ae73a8de_s.jpg',
      'http://static.flickr.com/77/199481108_4359e6b971_s.jpg',
      'http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg',
      'http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg',
      'http://static.flickr.com/58/199481218_264ce20da0_s.jpg',
      'http://static.flickr.com/69/199481255_fdfe885f87_s.jpg',
      'http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg',
      'http://static.flickr.com/70/229228324_08223b70fa_s.jpg',
  );
  
  $total    = count($images);
  $selected = array_slice($images, $first, $length);
  
  // ---
  
  header('Content-Type: text/xml');
  
  echo '<data>';
  
  // Return total number of images so the callback
  // can set the size of the carousel.
  echo '  <total>' . $total . '</total>';
  
  foreach ($selected as $img) {
      echo '  <image>' . $img . '</image>';
  }
  
  echo '</data>';
  
  ?>