I'm trying to auto insert ads in between my rows of a specific view. I have it triggering on every 5th row with the code below.

<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?>">
    <?php print $row; ?>
  </div>
  <?php if ($id == 5) :?>
    <h1>display ad here</h1>
    <div>'[ads:14 limit:1]'</div>

  <?php endif; ?>
<?php endforeach; ?>

My question is what can i call from my tpl.php file to have the ad displayed every nth row. Do i need to write a new module? Sorry im fairly new at the backend coding on drupal.

Comments

mundula’s picture

Issue summary: View changes
Issue tags: -Insert Ad +Insert Ad every nth row
minnur’s picture

@mundula, yes it's possible. Your approach should work.

minnur’s picture

Status: Active » Closed (won't fix)