All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Index/count for the first item in a category in Low Reorder

Amy Witty 7 May 2014 13:49 question, complete

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

  1. 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.

  2. Amy Witty 7 May 2014 14:04

    http://pastie.org/private/73on8qo9rrn...

  3. 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.

  4. Amy Witty 7 May 2014 14:58

     
    {exp:low_reorder:entries set="life-stages" category="{category_id}" prefix="lifestage"}

    {title}

    Entry Count: {lifestage_count}



    Results in: "Entry Count: _count".

  5. Low 7 May 2014 14:59

    The prefix is including the underscore, so try prefix="lifestage_" instead.

  6. Amy Witty 7 May 2014 15:01

    That works! Thanks, Low! (You're awesome.)

  7. Amy Witty 7 May 2014 15:07

    What is the syntax to test for lifestage_count == total_results?

  8. Low 7 May 2014 15:08

    Isn't {if lifestage_count == total_results} working for you?

  9. 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.

  10. Low 7 May 2014 15:18

    Hmm, yeah, the prefix thing is tricky that way. Try the quoted and braced version:

    {if "{lifestage_count}" == "{lifestage_total_results}"}</dl>{/if}

  11. 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"}

  12. Low 7 May 2014 15:30

    Ugh. How about

    {if lifestage_count == "{lifestage_total_results}"}

  13. Amy Witty 7 May 2014 15:32

    Success! Thanks again!