0

I'm trying to wrap items in a ul if there are more than one, however I am getting the if always false, this is caused due to {feature_content:total_results} returning false. I end up with <h1>TOTAL: ""</h1> so it's not even zero.

Can someone enlighten me as to what I'm missing?

{exp:channel:entries channel="feature"} 
<!-- Feature Section -->
<div class="layoutholder">
    <div class="row">
        <div class="small-12 large-10">
            <h1>TOTAL: "{feature_content:total_results}"</h1>
            {if feature_content:total_results > 1}
                <ul class="bxslider-features">
                    {feature_content}
                        <li><div>{feature_content:content}</div></li>
                    {/feature_content}
                </ul>
            {if:else}
                {feature_content}
                    <div>{feature_content:content}</div>
                {/feature_content}
            {/if}
        </div>
    </div>
</div>
{/exp:channel:entries} 

Based on this answer Relationship field entries total count I would have thought the above to work.

0

This fails for me:

{if feature_content:total_results > 1}

Shouldn't it be?

{if feature_content:total_results >= 1}

If it's less than 1, there are no relationships to show anyway.

| improve this answer | |
  • Well, I should potentially have an initial if clause for if not to not show anything. But currently that doesn't matter as the initial problem remains of feature_content:total_results returning null (there are items as feature_content:content is spitting out what I would expect). – Hailwood Feb 25 '16 at 20:03
  • From what I've gathered it's something to do with counts getting messed up when a relationship field is looped inside {exp:channel:entries} – Hailwood Feb 25 '16 at 20:05
  • When I try this locally and make the change to >=, it counts correctly. You're not wrapping it with a {feature_content} pair as well? – Holland Feb 26 '16 at 10:16
  • Nope, that's the literal template in my question, not even summarized. Just double checking EE3 right? – Hailwood Feb 27 '16 at 5:37
0

Found it!

{feature_content:total_rows}

Would be super useful if this was actually documented anywhere I could find!

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