ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

No related Reverse entries - Help me on this

August 26, 2008 1:44pm

Subscribe [4]
  • #1 / Aug 26, 2008 1:44pm

    SC CTSI at USC

    7 posts

    <h2>Price List</h2>
    <p><table><br />
        <thead><br />
            <th>Service</th><br />
            <th>USC Price</th><br />
            <th>Non USC Price</th>                        <br />
        </thead><br />
        <tbody><br />
        {reverse_related_entries weblog = "core_facilities_prices" orderby="title"}<br />
        {if no_reverse_related_entries}<br />
        No price list for this Core Facility.<br />
        {/if}<br />
        <tr class="{switch='odd|even'}"><br />
            <td>{title}</td><br />
            <td>{usc_price}</td><br />
            <td>{non_usc_price}</td><br />
        </tr><br />
        {/reverse_related_entries}                        <br />
        </tbody>                <br />
    </table>

    In the above code, I’d really like the no_reverse_related_entries to span the entire table declaration. But if I do this, that would give me multiple tables for each entry, wouldn’t it?

    How do I go about not showing the entire table when there are no related entries?

  • #2 / Aug 27, 2008 4:47pm

    grantmx

    1439 posts

    Only if you don’t limit the amount of entries it’s params.

    Use conditional variables to check for a value, like you did above, but include the full table in-between.

  • #3 / Aug 28, 2008 1:45pm

    Sean Gates

    123 posts

    Wouldn’t something like this work?

    <tr><td colspan="3">No price list for this Core Facility.</td></tr>
  • #4 / Aug 30, 2008 8:04am

    cherrypj

    158 posts

    Yeah, the reverse_related tag will execute everything inside its block. You’ll want to keep the table header outside of it, which means that Sean’s suggestion is probably the way to go. You’ll still see the table header with the column names, but maybe that’s an OK compromise?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases