Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jonathan Daggerhart

    (@daggerhart)

    Sorry for the late reply.

    Use the ‘Create Label’ checkbox and text input beneath it for a table header for that field.

    Hi,
    I understand that time passed since the last reply, but I think my experience with tables could add something to the discussion.
    When we add labels to fields and then select the “table” style, it appears the table with the correct thead and th, but labels are displayed also in each field…
    I dig into the structure of the style and that’s it:

    <table class="query-table query-<?php print $slug; ?>" cellpadding="0" cellspacing="0" border="0">
      <thead class="query-table-head">
        <?php foreach($rows[0]['fields'] as $field): ?>
          <th><?php print $field['label']; ?></th>
        <?php endforeach; ?>
      </thead>
      <tbody class="query-table-body">
        <?php foreach($rows as $row): ?>
          <tr class="<?php print $row['row_classes']; ?>">
    
            <?php foreach($row['fields'] as $field): ?>
              <?php if(isset($field['output'])): ?>
                <td class="<?php print $field['classes']; ?>">
                  <?php print $field['output']; ?>
                </td>
              <?php endif; ?>
            <?php endforeach; ?>
    
          </tr>
        <?php endforeach; ?>
      </tbody>
    </table>

    So it seems that $field is an array that has ‘label’, ‘classes’, and ‘output’, and the last one contains the field’s output and the label if is set. Maybe if it would be possible to output only the content of the field without the label… but I think we have to edit the $field array.

    What do you think? Suggestions?

    Thank you in advance! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Query Wrangler] How do I add column header content? (th tag)’ is closed to new replies.