0

Am I missing something? It displays the 0, and 1 comment, but not multiple comments.

I'm sure it's a simple answer, but I can't see what error I'm making, and I'm not getting any feedback in developer mode.

I'm using default comments with EE, and i'm using version 2.9.2.

Thanks!

{if {total_results} == 0}<h4>0 Comments</h4>
{if:elseif {total_results} == 1}<h4>{total_results} Comment</h4>     
{if:elseif {total_results} > 1}<h4>{total_results} Comments</h4>{/if}

2 Answers 2

0

Try these two variations:

{if total_results == 0}<h4>0 Comments</h4>
{if:elseif total_results == 1}<h4>{total_results} Comment</h4>     
{if:elseif total_results > 1}<h4>{total_results} Comments</h4>{/if}

or:

{if "{total_results}" == 0}<h4>0 Comments</h4>
{if:elseif "{total_results}" == 1}<h4>{total_results} Comment</h4>     
{if:elseif "{total_results}" > 1}<h4>{total_results} Comments</h4>{/if}

The template parser can get really wonky sometimes, and doesn't parse everything in the correct order.

1
  • Unfortunately, I'm still getting the same results. I suspected it might be parse order, but I hoped a simple if else wouldn't cause any problems. Commented Jul 7, 2015 at 15:36
0

Can you try something like this:

<h4>
{total_results} Comment{if total_results == "0" OR total_results > "1"}s{/if}
</h4>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.