0

I have a people page that is separated into three different categories, and I am using Low Reorder to allow my client custom control over what order the people are displayed in each category. That part works great. Now I'm trying to customize the output so that the final entry in each category is tagged with a specific class so that the layout will work right.

Here is what my template code looks like:

{exp:channel:categories style="linear" channel="People" show_empty="no"}
<h3>{category_name}</h3>
<div class="row">
{exp:low_reorder:entries set="staff" category="{category_id}"}
    <div class="large-3 columns text-center{if count == total_results} end{/if}">
        <p>... CE Image stuff ...</p>
        <h4 class="staff-grid-name"><a href="{page_url}">{count} {title} {total_results}</a></h4>
        <p class="organization-title staff-grid">{exp:low_widont}{person_organization_title}{/exp:low_widont}</p>
    </div>
    {switch='|||</div><div class="row">'}
{/exp:low_reorder:entries}
</div>
{/exp:channel:categories}

The relevant bit is this: {if count == total_results} end{/if}. I added in the {count} {title} {total_results so I could see what the count and total_results fields were.

The output I get is this:

  • All entries in the first category have a count of 1 and total_results of 3
  • All entries in the 2nd category have a count of 2 and total_results of 3
  • All entries in the 3rd category have a count of 3 and total_results of 3
  • Since all the 3rd category entries have total_results of 3, all entries in that category are tagged with the "end" class

Perhaps there's another way to achieve what I'm trying to do? Thanks!

UPDATE: I was able to achieve the desired layout effect by just giving all of the entries the 'end' tag, but this is inelegant to be sure. I am still interested in solving this problem the "right" way.

1

This is because of nesting the tags. Both {count} and {total_results} are used by both tags, so the outer tag parses the ones in the inner tag.

To avoid, you can either put the LR tag in an embed (with an embed variable), or (preferably) if you're using Low Variables, use LV like so:

{exp:low_variables:single var="lv_low_reorder_snippet" preparse:category_id="{category_id}"}

Third way to work around it, and perhaps the easiest, is to use LR's prefix parameter, for example:

{exp:low_reorder:entries prefix="pfx_" ... }
    {if '{pfx_count}' == '{pfx_total_results}'} ... {/if}
{/exp:low_reorder:entries}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.