appear div on maxCols

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 31, 2016   (RSS)

By petrogus - May 27, 2016 - edited: May 27, 2016

Hi I would like to ask your help on this question,
how can appear a div on start and at the end every 4 records

for example I have this code

<?php $maxCols = 4; $columnCount = 0; ?> 
<?php if (($columnCount % $maxCols) == 0) { echo "<div class=".chr(34)."row".chr(34).">";}?>
<?php foreach ($productsRecords as $record): ?>

<div class="col-md-3 >
.....
</div>

<?php endforeach ?>
<?php if (($columnCount % $maxCols) == 0) { echo "</div>";}?>

and I would like to appear on page the following

<div class="row">
<div class="col-md-3 >.....</div>
<div class="col-md-3 >.....</div>
<div class="col-md-3 >.....</div>
<div class="col-md-3 >.....</div>
</div>

<div class="row">
<div class="col-md-3 >.....</div>
<div class="col-md-3 >.....</div>
<div class="col-md-3 >.....</div>
<div class="col-md-3 >.....</div>
</div>

Thank you in advance

PetroGus

By petrogus - July 31, 2016

Thank Damon !!!

it works fine thank you for your help

PetroGus