By Terko on
Hello!
I am trying to insert ad inside table view, but when the result is rendered, I can see two ads, not just one, and the table become very wider.
I want to insert only one row with one column after the second view result. My code for the view-table.tpl.php is this
<?php
/**
* @file views-view-table.tpl.php
* Template to display a view as a table.
*
* - $title : The title of this group of rows. May be empty.
* - $header: An array of header labels keyed by field id.
* - $header_classes: An array of header classes keyed by field id.
* - $fields: An array of CSS IDs to use for each field id.
* - $class: A class or classes to apply to the table, based on settings.
* - $row_classes: An array of classes to apply to each row, indexed by row
* number. This matches the index in $rows.
* - $rows: An array of row items. Each row is an array of content.
* $rows are keyed by row number, fields within rows are keyed by field ID.
* - $field_classes: An array of classes to apply to each field, indexed by
* field id, then row number. This matches the index in $rows.
* @ingroup views_templates
*/
?>
<table class="<?php print $class; ?>"<?php print $attributes; ?>>
<?php if (!empty($title)) : ?>
<caption><?php print $title; ?></caption>
<?php endif; ?>
<thead>
<tr>
<?php foreach ($header as $field => $label): ?>
<th class="<?php print $header_classes[$field]; ?>">
<?php print $label; ?>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($rows as $count => $row): ?>
<tr class="<?php print implode(' ', $row_classes[$count]); ?>">
<?php foreach ($row as $field => $content): ?>
<td class="<?php print $field_classes[$field][$count]; ?>" <?php print drupal_attributes($field_attributes[$field][$count]); ?>>
<?php if ($count == 2) :?>
<My AdSense code is here>
<?php endif; ?>
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
Please, give me any suggestion what I can add here to achieve this result? My table is with 2 columns, but the ad must be in single column after second result.
Thank you in advance!