Quote:
It all works great but what i want is that every (x) number to create a new div with the specified tags in it.
As I understand, you have:
<div>
<img />
</div>
<div>
<img />
</div>
<div>
<img />
</div>
<div>
<img />
</div>
<div>
<img />
</div>
<div>
<img />
</div>
<div>
<img />
</div>
<div>
<img />
</div>
and you want:
<div>
<img />
<img />
<img />
</div>
<div>
<img />
<img />
<img />
</div>
<div>
<img />
</div>
or:
<div>
<img />
<img />
<img />
</div>
your code will have this structure:
printed_images=0
echo <div> // once
loop on images
{
if (printed_images == 3)
{ // once every 3 images
echo <div>
echo </div>
printed_images=0
}
echo <img /> // once per image
printed_images++
}
echo </div> // once