Hi Jesus,
A fairly easy way to specify something to happen every "X" records is using the modulo operator (%), where $a % $b returns the remainder of $a divided by $b. For example: 5 % 3 = 2.
If you add a counter to your loop and apply a modulo of 3 to it, it will be able to tell you which position the item is, as "X % 3" will always return 0, 1, or 2. If you're using a regular CMSB list section, it could look something like this:
<?php $counter = 1; ?>
<?php foreach ($sectionRecords as $record): ?>
<?php
$class = '';
if ($counter % 3 == 0) {
$class = 'last_column';
}
$counter++;
?>
<div class="item <?php echo $class; ?>">
...
</div>
<?php endforeach; ?>
You'll need to adapt this to your own code, but hopefully, this gets you going in the right direction.
Let me know if you have any questions!
Thanks,
Daniel
Technical Lead
interactivetools.com