views-view-grid.tpl.php

  1. 3.x theme/views-view-grid.tpl.php
  2. 2.x theme/views-view-grid.tpl.php

Default simple view template to display a rows in a grid.

  • $rows contains a nested array of rows. Each row contains an array of columns.

File

theme/views-view-grid.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Default simple view template to display a rows in a grid.
  5. *
  6. * - $rows contains a nested array of rows. Each row contains an array of
  7. * columns.
  8. *
  9. * @ingroup views_templates
  10. */
  11. ?>
  12. <?php if (!empty($title)) : ?>
  13. <h3><?php print $title; ?></h3>
  14. <?php endif; ?>
  15. <table class="<?php print $class; ?>"<?php print $attributes; ?>>
  16. <?php if (!empty($caption)) : ?>
  17. <caption><?php print $caption; ?></caption>
  18. <?php endif; ?>
  19. <tbody>
  20. <?php foreach ($rows as $row_number => $columns): ?>
  21. <tr <?php if ($row_classes[$row_number]) { print 'class="' . $row_classes[$row_number] .'"'; } ?>>
  22. <?php foreach ($columns as $column_number => $item): ?>
  23. <td <?php if ($column_classes[$row_number][$column_number]) { print 'class="' . $column_classes[$row_number][$column_number] .'"'; } ?>>
  24. <?php print $item; ?>
  25. </td>
  26. <?php endforeach; ?>
  27. </tr>
  28. <?php endforeach; ?>
  29. </tbody>
  30. </table>

Related topics