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_comments returns "0"

February 10, 2012 12:55pm

Subscribe [2]
  • #1 / Feb 10, 2012 12:55pm

    Will Dieterle

    56 posts

    Hi All,

    I recently migrated an ExpressionEngine blog to a new server and upgraded to v2.4.0 - Build: date 20120123.

    After the migration, but even before the update, I noticed that the {total_comments} tag is returning 0 for all entries that have comments. Nothing at all is returned for entries without comments (which is expected).  I’ve emptied the system caches and template caches.  Any thoughts?

    Thanks,

    Will

  • #2 / Feb 10, 2012 9:58pm

    Will Dieterle

    56 posts

    This may have gone under the radar.  Does anyone have any thoughts on a solution?

    Will

  • #3 / Feb 11, 2012 8:07pm

    Dan Decker

    7338 posts

    Hey Will,

    I’m sorry {total_comments} is misbehaving for you. Lets see if we can get this sorted out.

    Can you provide so more context here? Do you notice it all the time? On several templates, or one in particular? Can you share the template code here for us to review?

    If this is a bug, as much information as you can possible provide would help us replicate.

    Thanks!

  • #4 / Feb 11, 2012 8:24pm

    Will Dieterle

    56 posts

    Thanks so much, Dan.  The issue seems to be independent of the template (in other words, same issue in all templates and fresh ones created for testing).  Here is what I am using (simplified here because the actual page template is rather large).  I can PM access to the CP and full templates.  This wasn’t an issue until a recent migration to a MediaTemple dv server.

    {exp:channel:entries}
    {if allow_comments} 
    {exp:comment:entries entry_id="{entry_id}" limit="1" dynamic="no"}<a href="http://{path="> {total_comments}</a>{/exp:comment:entries} 
    {/if}
    {/exp:channel:entries}
  • #5 / Feb 13, 2012 9:30am

    Mark Bowen

    12637 posts

    The {exp:comment:entries} tag shouldn’t be nested inside the {exp:channel:entries} tag like that.

    This is why you are seeing this problem here.

    If you are trying to find the comments total for a certain entry then take a look at the {comment_total} Channel Entries Tag variable instead.

    Best wishes,

    Mark

  • #6 / Feb 13, 2012 1:29pm

    Will Dieterle

    56 posts

    Well, I feel foolish.  I must have just gotten lucky in the past.  Thanks so much Mark and sorry to bother!

    Will

  • #7 / Feb 13, 2012 5:49pm

    Dan Decker

    7338 posts

    Hi Will,

    I’m glad Mark was able to point that out to you. Also, the {if allow_comments} conditional is intended to display some information about the entry if comments are enabled.

    Mark, it is good to see you again! Thanks for chipping in!

    If either of you need anything else in the future, you know where to find us.

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases