Query Wrangler
[resolved] How do I add column header content? (th tag) (3 posts)

  1. madai
    Posted 4 years ago #


    Please help me with this, I really need to name my columns in the table. I can see that the th tags are there but they are empty and I can't figure out how to populate them with some content.

    Thanks in advance



  2. Jonathan Daggerhart
    Plugin Author

    Posted 3 years ago #

    Sorry for the late reply.

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

  3. Tubia
    Posted 3 years ago #

    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; ?>
      <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']; ?>
              <?php endif; ?>
            <?php endforeach; ?>
        <?php endforeach; ?>

    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! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Query Wrangler
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic