• Resolved cnyrpdbwebmaster

    (@cnyrpdbwebmaster)


    I would like to show some information in tabular form but the entire table gets recreated for each record. Is there a way to to make the loop happen only over the rows?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cnyrpdbwebmaster

    (@cnyrpdbwebmaster)

    I think I have the solution: create a table with the header row, then go into HTML view and put the shortcode after the header row and before </table>. I’ll try it out tomorrow.

    Plugin Author Franky

    (@liedekef)

    Hi,

    for things that get looped (like the list of events or bookings), you can provide a header/entry/footer template, so put the html-header part of the table in the header, one row in the entry and the html-footer part of the table in the footer.

    Thread Starter cnyrpdbwebmaster

    (@cnyrpdbwebmaster)

    Franky,

    Thank you for your help. I got this to work but I don’t think it’s what you were explaining. What I did that worked was to create a “dummy” person whose sole purpose is to be in a group (with only that one person (but I guess any person would have been fine)) which I then use for the header and footer. Here’s what I have in the page:

    [eme_people group_id=3 template_id=3] : Group of 1 person, header template
    [eme_people group_id=1 template_id=2] : The group I want to display
    [eme_people group_id=3 template_id=4] : Group of 1 person, footer template

    Another approach that worked was to create another template with the table header and footer and then call the template with the content I want:

    <table style="border-collapse: collapse;width: 100%">
    <tbody>
    <tr>
    <th style="width: 25%" scope="col">Name</th>
    <th style="width: 25%" scope="col">Title</th>
    <th style="width: 25%" scope="col">Phone</th>
    <th style="width: 25%" scope="col">E-mail</th>
    </tr>
    [eme_people group_id=1 template_id=2]
    </tbody>
    </table>
    &nbsp;

    So then, of course I can put what I put in the page in a template and have just this in the page:

    [eme_people group_id=3 template_id=6]

    Is this more-or-less what you were getting at? In any case, all options work the same way. Is there a way I could have done this without creating a group of one person?

    Thanks,
    Bruce

    Plugin Author Franky

    (@liedekef)

    Simplest solution: create 3 templates. First a header template with (based on your example) ID=3:

    <table style="border-collapse: collapse;width: 100%">
    <thead>
    <tr>
    <th style="width: 25%" scope="col">Name</th>
    <th style="width: 25%" scope="col">Title</th>
    <th style="width: 25%" scope="col">Phone</th>
    <th style="width: 25%" scope="col">E-mail</th>
    </tr>
    </thead>
    <tbody>

    Then a footer template with ID=4:

    </tbody>
    </table>

    The a template with id=2 (change the placeholders to your liking):

    
    <tr>
    <td>#_NAME</td>
    <td>#_FIELD{title}</td>
    <td>#_PHONE</td>
    <td>#_EMAIL</td>
    </tr>
    

    and then just call the templates:
    [eme_people group_id=1 template_id_header=3 template_id=2 template_id_footer=4]
    the template with id=2 will get repeated for each person in the group with id=1

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Displaying a table for a template’ is closed to new replies.