Index/count for the first item in a category in Low Reorder
I am creating a categorized definition list of entries using Low Reorder. I have LR setup to allow me to order each category in the channel separately (using the category dropdown to select a category, then reordering). This is all working great.
In my template, I am using tabs and accordions (within the tabs) to display some content. The tabs are the category names and the accordions are for each entry within that category. I would like to have some different markup for the first entry in each category (the first accordion in each tab). How do I correctly identify the first entry in each category?
I tried using {count}
, but the numbering does not start over with each category. I tried {exp:low_reorder:entry_index set="set_name" category="{category_id}"}
.
Appreciate your help!
Replies
Low 7 May 2014 13:54
What's your full template code right now? You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.
Amy Witty 7 May 2014 14:04
http://pastie.org/private/73on8qo9rrn...
Low 7 May 2014 14:18
Looks like it's a conflict between the outer {exp:channel:categories} tag's {count} var and the inner {exp:low_reorder:entries} tag's {count} var.
Try using LR's prefix="" parameter to avoid it around it.
Amy Witty 7 May 2014 14:58
Results in: "Entry Count: _count".
Low 7 May 2014 14:59
The prefix is including the underscore, so try prefix="lifestage_" instead.
Amy Witty 7 May 2014 15:01
That works! Thanks, Low! (You're awesome.)
Amy Witty 7 May 2014 15:07
What is the syntax to test for lifestage_count == total_results?
Low 7 May 2014 15:08
Isn't {if lifestage_count == total_results} working for you?
Amy Witty 7 May 2014 15:16
I tried:
{if lifestage_count == lifestage_total_results}</dl>{/if}
.Shouldn't that work?
If I do
{lifestage_total_results}
it outputs the correct number.Low 7 May 2014 15:18
Hmm, yeah, the prefix thing is tricky that way. Try the quoted and braced version:
Amy Witty 7 May 2014 15:29
When using:
{if "{lifestage_count}" == "{lifestage_total_results}"}
Results in:
PHP Error: Message: Invalid EE Conditional Variable: {if "{"5"}
Low 7 May 2014 15:30
Ugh. How about
Amy Witty 7 May 2014 15:32
Success! Thanks again!