I'm trying to display an ad every six rows of a view. I'm thinking of using another view that contains all the ads and displaying a random result of that every 6 rows of the main view.
Drupal 7 & Views 3.14
I have tried to do this but gotten stuck on the displaying something every 6 rows. Here is my code:
...code irrelevant, unedited coded copied from the template file in views module folder...
<tbody>
<?php foreach ($rows as $row_count => $row): ?>
<tr <?php if ($row_classes[$row_count]) { print 'class="' . implode(' ', $row_classes[$row_count]) .'"'; } ?>>
<?php foreach ($row as $field => $content): ?>
<td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php print drupal_attributes($field_attributes[$field][$row_count]); ?>>
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php if ((($row_count % 6) == 0 && $row_count !== 0): ?><tr>This is the row after every 6th multiple</tr><?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
UPDATE: I figured out a way to print a random result. Just add randomize as the only sort in the view. However, I still can't get the printed view result to be in the appropriate location.
<tr>
tags are not showing up, but rather the results are just appearing at the very top of the table, not at the appropriate place.