Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <?php
  2. /**
  3. * Implements hook_preprocess_views_view_grid().
  4. *
  5. * Check if there is no result for this group and provide an appropraite message.
  6. *
  7. */
  8. function phptemplate_preprocess_views_view_grid(&$variables) {
  9. if (empty($variables['rows'])) {
  10. $variables['caption'] = t('No results.');
  11. }
  12. }
  13.  
  14. <?php
  15.  
  16. /**
  17. * @file
  18. * Default simple view template to display a rows in a grid.
  19. *
  20. * - $rows contains a nested array of rows. Each row contains an array of
  21. * columns.
  22. *
  23. * @ingroup views_templates
  24. */
  25. ?>
  26. <?php if (!empty($title)) : ?>
  27. <h3><?php print $title; ?></h3>
  28. <?php endif; ?>
  29.  
  30. <?php // We check if there is no result we print a meesage ?>
  31. <?php if (empty($rows)) : ?>
  32. <?php print t('No results.'); ?>
  33. <?php endif; ?>
  34.  
  35. <table class="<?php print $class; ?>"<?php print $attributes; ?>>
  36. <?php if (!empty($caption)) : ?>
  37. <caption><?php print $caption; ?></caption>
  38. <?php endif; ?>
  39.  
  40. <tbody>
  41. <?php foreach ($rows as $row_number => $columns): ?>
  42. <tr <?php if ($row_classes[$row_number]) { print 'class="' . $row_classes[$row_number] .'"'; } ?>>
  43. <?php foreach ($columns as $column_number => $item): ?>
  44. <td <?php if ($column_classes[$row_number][$column_number]) { print 'class="' . $column_classes[$row_number][$column_number] .'"'; } ?>>
  45. <?php print $item; ?>
  46. </td>
  47. <?php endforeach; ?>
  48. </tr>
  49. <?php endforeach; ?>
  50. </tbody>
  51. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement