Hi. I've solved issues like this before by the use of a code to count instanses and then place something in each place I need it.
$counter++; // to count each time the code is run
Then:
if ($counter == '10') {
echo 'your code'; // your ad code
$teller = 0; // reset it so that if there are 10 new items, a new ad code will be placed
}
You can see my version at play over at https://drm24.no (here I use an external ad system, but the code above is how I place them in the right places on the front page)