Here’s the video I watched, where I saw the technique. Not sure why I hadn’t thought of array_chunk()
before for this, but it works great:
https://laracasts.com/lessons/crazy-simple-pagination
Basically to create a 3 column row, here we go:
<?php
foreach (array_chunk($all_items, 3) as $row) {
?>
<div class="row">
<?php
foreach ($row as $item) {
?>
<div class="item">
<img src="">
</div><!-- /item -->
<?php
}
?>
</div><!-- /row -->
<?php
}
?>