I am trying to make a gallery of "endless scrolling" to an external website using tumblr photos.
Everything works, but I have a big problem.
My foreach function stops working after the first 20 results. The endless scroll needs pagination, and I need:
- To get the whole message, not just the first 20
- A way to count stars from the 21st post and then after the 31st to create pagination
this is php which i use with masonry
<div id="container"> <?php // tag filtrante $tag = 'conceptual'; $api_key = 'the key'; // preleva e decodifica il file (prende solo i post di di tipo "photo") $tumblr = json_decode(file_get_contents('http://api.tumblr.com/v2/blog/nofrillsintown.tumblr.com/posts/photo?api_key=' . $api_key . '&tag=' . $tag)); // scorre tutti i post foreach ($tumblr->response->posts as $post) { // scorre tutte le immagini contenute in un post foreach ($post->photos as $photo) { echo '<div class="item"><a href="'.$photo->original_size->url.'" rel="lightbox"><img src="'.$photo->alt_sizes[2]->url.'" /></a></div>'; }; }; ?> </div>
source share