0
I have a PHP array with about 10,000 keys organized like this:
Array
(
[0] => Array
(
[id] => 13154
[photo_file] => 013154.jpg
)
[1] => Array
(
[id] => 7885
[photo_file] => 007885.jpg
)
)
And in the HTML file I have a loop that turns the array into image tags like this:
<?php
foreach ($array as $key => $value) {
$photo_file = $array[$key]["photo_file"];
echo "<img src='$photo_file' />";
?>
I wanted to create an Infinite Scroll from this PHP array to avoid loading all the images at once when the page was accessed. Any idea of the best way to do this?
Maybe I could convert the PHP array to JSON and then to a Javascript variable to use Jquery?
Thanks Juven, I ended up adopting his second approach (LIMIT + AJAX + GET), more classic and with more content. For this, I added a condition in the query, because before I was using PHP to filter the results and mount the array.
– Vini Goulart