If I have the following code:
<?php foreach ($posts as $post): ?>
<li>POST</li>
<?php endforeach; ?>
How would I show an advert in between the posts say every 5 items or just once after 5 items?
I thought about something like $post[5] but not sure if I’m barking up the wrong tree. Any suggestions/feedback and examples would be appreciated.
Assuming the data is uniformly indexed (and if it’s the result of a CakePHP
find(), it is):