I am trying to show elements in a responsive structure based in 4 columns like this:
+------------------------ row ------------------------+
[--col-*-3--] [--col-*-3--] [--col-*-3--] [--col-*-3--]
+------------------------ row ------------------------+
[--col-*-3--] [--col-*-3--] [--col-*-3--] [--col-*-3--]
So I proceed to iterate the items:
<div class="row">
<?php foreach ($items as $i): ?>
<div class="col-lg-3">
<?php echo $i->getName(); ?>
</div>
<?php endforeach; ?>
</div>
The code above will work for 4 items or less because twitter bootstrap grid systems (I think so) is based on 12 cols per row. I want to avoid this:
+------------------------ row ------------------------+
[--col-*-3--] [--col-*-3--] [--col-*-3--] [--col-*-3--]
[--col-*-3--] ...
+------------------------ row ------------------------+
[--col-*-3--] [--col-*-3--] [--col-*-3--] [--col-*-3--]
So, some people could say "chunk the array or use a flag to track if row is fill". But I want to avoid these operations in the html file. My question is, how can I deal with this design keeping four columns
structure without broke responsive layout? Thank you in advance