Advertisement
Adam_Wadsworth

Tumble Infinite Scroll

Mar 21st, 2012
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Infiniti Phase 2.0 </title>
  6.  
  7. <!-- CSS Start -->
  8. <link rel="stylesheet" href="css/global.css" />
  9. <!-- CSS Finished -->
  10.  
  11. <!-- Scripts Start -->
  12.  
  13. <!-- jQuery Source -->
  14. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  15.  
  16. <!-- Infinite Scroll Requirements -->
  17. <script type="text/javascript" src="http://www.media21a.co.uk/new/wp-content/themes/media21a-theme/js/infinite-scroll.js"></script>
  18. <script type="text/javascript">
  19. // Infinity Scroll
  20. jQuery(document).ready(function($) {
  21. $('#container').infinitescroll({
  22. debug : false,
  23. loading : {},
  24. state : {currPage : "1"},
  25. nextSelector : "div.tumblr_postnav a.tumblr_next",
  26. navSelector : "div.tumblr_postnav",
  27. contentSelector : "#container",
  28. itemSelector : "#container a.single-image",
  29. pathParse : ["<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?>/", "/"]
  30. });
  31.  
  32. });
  33. </script>
  34. <!-- Infinite Scroll Finished -->
  35.  
  36. <!-- Scripts Finished -->
  37. </head>
  38. <body>
  39.  
  40. <div class="header">
  41. <a href="" class="logo" title="Infiniti Phase 2.0">
  42. Infiniti Phase 2.0
  43. </a>
  44.  
  45. </div>
  46.  
  47. <div id="container">
  48. <?php
  49.  
  50. $offset = $_GET['offset'];
  51. $ch = curl_init();
  52. curl_setopt($ch,CURLOPT_URL,"http://fuckyeahgirlswithtattoos.tumblr.com/api/read/json?num=10&start=".$offset);
  53. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  54. $result = curl_exec($ch);
  55. curl_close($ch);
  56. $result = str_replace("var tumblr_api_read = ","",$result);
  57. $result = str_replace(';','',$result);
  58. $result = str_replace('\u00a0',' ',$result);
  59. $jsondata = json_decode($result,true);
  60. $posts = $jsondata['posts'];
  61. ?>
  62.  
  63. <?php foreach($posts as $post){ if ($post['type'] == 'photo') { ?>
  64. <a href="<?php echo $post['photo-url-500'];?>" title="<?php echo date("jS M",strtotime($post['date'])); ?>" class="single-image">
  65. <img src="<?php echo $post['photo-url-500'];?>" alt="<?php echo date("jS M",strtotime($post['date'])); ?>">
  66. </a>
  67. <?php }
  68. }?>
  69.  
  70. <div class="tumblr_postnav">
  71. <a href="http://www.media21a.co.uk/development/infiniti/update/index.php<?php echo '?offset='.($offset + 10) ?>" class="tumblr_next">Older posts</a>
  72. </div>
  73.  
  74. </div>
  75.  
  76. <a href="http://www.media21a.co.uk/development/infiniti/update/index.php<?php echo '?offset='.($offset + 10) ?>" class="older">Older</a>
  77.  
  78.  
  79. </body>
  80. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement