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.

total_results repeating?

October 07, 2012 8:34am

Subscribe [2]
  • #1 / Oct 07, 2012 8:34am

    pixelcamp

    26 posts

    Hi ,

    I want to display the total results of a channel and this is working but if there are 10 results, the number of times this is output is 10 also! When   I limit to 1 I get just 1 as the total result (even though there are 10) - how do you just plain show the total results?


    Thanks

  • #2 / Oct 07, 2012 11:13am

    pixelcamp

    26 posts

    This is what I am using

    {exp:channel:entries channel="products" limit="10" dynamic="yes"}

    <caption>{total_results} {if no_results}
      <caption>There are no products</caption>
      {/if} for sale</caption>

    {/exp:channel:entries}

    But if the results are say 10 then I get 10 captions? The entries are assigned to category children and seems like a regular requirement to retrieve this info?

    Thanks

  • #3 / Oct 08, 2012 2:15pm

    Lisa Wess

    20502 posts

    Hi, pixelcamp -


    I’ve moved this up to the EE 2 technical support forum for you.

    Yes, those variables and everything inside the tag will repeat for each entry - so 10 times.

    Try adding this:

    {if count == total_results}
    {total_results}
    {/if}

    I hope that helps!

     

  • #4 / Oct 08, 2012 2:56pm

    pixelcamp

    26 posts

    Oh thanks Lisa, hats really great!

  • #5 / Oct 09, 2012 4:22pm

    Shane Eckert

    7174 posts

    Hey pixelcamp,

    How are things now? Can I offer any more help?

    Cheers,

  • #6 / Oct 09, 2012 4:53pm

    pixelcamp

    26 posts

    No, thanks works a charm and loving EE more by the minute!

  • #7 / Oct 10, 2012 4:23pm

    Kevin Smith

    4784 posts

    That’s awesome to hear, pixelcamp!

    Let us know when we can help again. 😊

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

ExpressionEngine News!

#eecms, #events, #releases