1 | <?php |
---|
2 | /** |
---|
3 | * @file views-view-table.tpl.php |
---|
4 | * Template to display a view as a table. |
---|
5 | * |
---|
6 | * - $title : The title of this group of rows. May be empty. |
---|
7 | * - $header: An array of header labels keyed by field id. |
---|
8 | * - $header_classes: An array of header classes keyed by field id. |
---|
9 | * - $fields: An array of CSS IDs to use for each field id. |
---|
10 | * - $class: A class or classes to apply to the table, based on settings. |
---|
11 | * - $row_classes: An array of classes to apply to each row, indexed by row |
---|
12 | * number. This matches the index in $rows. |
---|
13 | * - $rows: An array of row items. Each row is an array of content. |
---|
14 | * $rows are keyed by row number, fields within rows are keyed by field ID. |
---|
15 | * - $field_classes: An array of classes to apply to each field, indexed by |
---|
16 | * field id, then row number. This matches the index in $rows. |
---|
17 | * @ingroup views_templates |
---|
18 | */ |
---|
19 | ?> |
---|
20 | <table class="<?php print $class; ?>"<?php print $attributes; ?>> |
---|
21 | <?php if (!empty($title)) : ?> |
---|
22 | <caption><?php print $title; ?></caption> |
---|
23 | <?php endif; ?> |
---|
24 | <?php if (!empty($header)) : ?> |
---|
25 | <thead> |
---|
26 | <tr> |
---|
27 | <?php foreach ($header as $field => $label): ?> |
---|
28 | <th class="<?php print $header_classes[$field]; ?>"> |
---|
29 | <?php print $label; ?> |
---|
30 | </th> |
---|
31 | <?php endforeach; ?> |
---|
32 | </tr> |
---|
33 | </thead> |
---|
34 | <?php endif; ?> |
---|
35 | <tbody> |
---|
36 | <?php foreach ($rows as $row_index => $row): ?> |
---|
37 | <tr class="<?php print implode(' ', $row_classes[$row_index]); ?>"> |
---|
38 | <?php foreach ($row as $field => $content): ?> |
---|
39 | <td class="<?php print $field_classes[$field][$row_index]; ?>" <?php print drupal_attributes($field_attributes[$field][$row_index]); ?>> |
---|
40 | <?php print $content; ?> |
---|
41 | </td> |
---|
42 | <?php endforeach; ?> |
---|
43 | </tr> |
---|
44 | <?php endforeach; ?> |
---|
45 | </tbody> |
---|
46 | </table> |
---|