We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Displaying total results from plugin - shows total on each loop

Development and Programming

dsloan's avatar
dsloan
48 posts
15 years ago
dsloan's avatar dsloan

Not sure if I am misunderstanding the way this works…

I’ve been reading the docs at http://expressionengine.com/public_beta/docs/development/usage/template.html

I have followed this in the example below, and am getting results back, but the total_results tag is being shown for each loop, suggesting that I haven’t got my array of “properties” set up right, since it’s outside this loop and I thought it should have only been shown once, followed by all the properties.

{exp:rentpro:search}

    {total_results} results
    
    {properties}
        <strong>ID {property_id}:</strong> {address1}<br>
        {address2}<br>
        {town}<br>
        {county}<br>
        {postcode}<br>
        <hr>
    {/properties}

{/exp:rentpro:search}

Am I understanding this right? Should I be able to get the following:

3 results

Property 1 (shortened for clarity)
Property 2
Property 3

What I am actually seeing is:

3 results
Property 1 (shortened for clarity)

3 results
Property 2

3 results
Property 3
       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

Just like if you did this in the channel entries tag, it’s going to output for each iteration.

You should be able to use:

{if count == "1"}{total_results}{/if}

if you’ve got your module coded to handle conditionals.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.