Hello everyone, I'm new here. Amazing forum, I found some help in the past by searching google.
Now I am looking for some help with the following code, I use this code to grab a JSON Feed and list the items in my page, this code works fine to get all the items, but I need to limit the number of items, otherwise It will load more than 500 items in my page and never stop loading.
Is there a way to limit the number of items grabbed from the JSON Feed?
Let's say, list 50 items in page 1, another 50 in page 2 and so on?
<?php
$data = file_get_contents('http://json-url.com/type=json');
$decode = json_decode($data, true);
foreach($decode as $d) {
if($d['status'] == true){
echo '<div class="div">';
echo '<a href="'.$d['item_url'].'">';
echo '<img src="'.$d['item_image']['jpeg_thumbnail'].'" />';
echo '<span>'.$d['item_name'].'</span>';
echo '</a>';
echo '</div>';
}
}
?>
Thanks!