You are here

tablesorter-view.tpl.php in Tablesorter 7

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.
  • $caption: The caption for this table. May be empty.
  • $header_classes: An array of header classes keyed by field id.
  • $fields: An array of CSS IDs to use for each field id.
  • $classes: 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.

File

views/tablesorter-view.tpl.php
View source
<?php

/**
 * @file
 * 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.
 * - $caption: The caption for this table. May be empty.
 * - $header_classes: An array of header classes keyed by field id.
 * - $fields: An array of CSS IDs to use for each field id.
 * - $classes: 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
 */
?>
<div class="tablesorter_wrapper">
  <table <?php

if ($classes) {
  print 'class="tablesorter ' . $classes . '"';
}
print $attributes;
?>>
    <?php

if (!empty($title) || !empty($caption)) {
  ?>
      <caption><?php

  print $caption . $title;
  ?></caption>
    <?php

}
?>
    <?php

if (!empty($header)) {
  ?>
      <thead>
        <tr>
          <?php

  foreach ($header as $field => $label) {
    ?>
            <th scope="col">
              <?php

    print $label;
    ?>
            </th>
          <?php

  }
  ?>
        </tr>
      </thead>
    <?php

}
?>
    <tbody>
      <?php

foreach ($rows as $row_count => $row) {
  ?>
        <tr>
          <?php

  foreach ($row as $field => $content) {
    ?>
            <td>
              <?php

    print $content;
    ?>
            </td>
          <?php

  }
  ?>
        </tr>
      <?php

}
?>
    </tbody>
  </table>
  <?php

if ($tvpager == 1) {
  ?>
    <div id="tablesorter_pager" class="tablesorter_pager">
      <form>
        <span class="first">first</span>
        <span class="prev">prev</span>
        <input type="text" class="pagedisplay"/>
        <span class="next">next</span>
        <span class="last">last</span>
        <select class="pagesize">
          <option selected="selected"  value="10">10</option>
          <option value="20">20</option>
          <option value="30">30</option>
          <option  value="40">40</option>
        </select>
      </form>
    </div>
  <?php

}
?>
</div>