Skip to content

Instantly share code, notes, and snippets.

@iign
Created July 19, 2017 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iign/2bffdc2f2e8c7c841034fff7c20cf34c to your computer and use it in GitHub Desktop.
Save iign/2bffdc2f2e8c7c841034fff7c20cf34c to your computer and use it in GitHub Desktop.
Looping lists in chunks/batches, as mentioned here http://blog.ign.uy/2017/loop-list-in-batches-using-twig
<?php foreach (array_chunk($photoList, 2) as $photos): ?>
<div class="grid-row">
<?php foreach ($photos as $key => $photo): ?>
<div class="grid-overlay__img-container">
<div class="grid-overlay__img" data-src="<?= $photo['url_full'] ?>"></div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment