I have a foreach loop that builds me a product page basically it out puts my products in rows of 3.
See the code:
foreach ($product_sets as $product)
{
$currentRow = ceil($currentItem / 3);
$currentColumn = $currentItem - (($currentRow - 1) * 3);
if ($number_of_blanks == 2) :
if (($number_of_rows > 1 && $currentRow == ($number_of_rows - 1) && $currentColumn == 2) || ($number_of_rows == 1 && $currentColumn == 1)) :
?>
<li><img src="<?php echo site_url('assets/img/blocks/guarantee.png'); ?>" alt="5 Year Guarantee" width="242" height="156"></li>
<?php
$currentItem++;
endif;
endif;
?>
<li class="<?php if($currentItem % 3 == 0) echo 'endHomeBlock';?>">
<?php $this->load->view('blocks/product_small', array('product' => $product)); ?>
</li>
<?php
$currentItem++;
}
What I am wanting be able to do is place an image (A point of sale) at the end of the first row, and the randomly through the other rows, but maintaining 3 items (including image a point of sale) on a row. I have the image paths in an array called images which looks similar to this,
$images = array(
'iamge1.png',
'image2.png,
'image3.png,
'image4.png,
);
How can I achieve this? I have been scrathing around for a few hours now :(