EllisLab text mark
Advanced Search
     
Total Comments not updating
Posted: 22 September 2008 08:10 AM
Joined: 2008-01-30
23 posts

Hello,
I am working on a website which has a forum made using a weblog.

Basically, every new topic will allow registered users to add comments to them.

And in the Topic list page it should show:
-title of topic
-total comments
-last author
-time of last post

The code I used is :

<h2 class="forums">Forums</h2>
<
class="forumpath">
<
a href="{path={my_template_group}/forums}">Reference Group Forums</a>
>> 
{exp:weblog:entries weblog="{my_weblog}"}{title}{/exp:weblog:entries}
</p>
<
table border="0" cellpadding="2" cellspacing="0">
<
tr class="title">
    <
td class="topic">Available Topics</td>
    <
td class="posts">Posts</td>
    <
td class="lastby">Last Posted By</td>
    <
td class="lastpost">Last Posted</td>
 </
tr>

{exp:weblog:entries weblog="{my_weblog}"}
{reverse_related_entries sort
="desc" orderby="date" limit="10" paginate="bottom"}
  
<tr class="{switch="blue|white"}">
    <
td><a href="{path={my_template_group}/posts/{url_title}}">{title}</a></td>
    <
td class="posts">{comment_total}</td>
    <
td class="lastby">{author}</td>
    <
td class="lastpost">{entry_date format="%F %d, %Y - %g:%i:%s"}</td>
  </
tr>
{/reverse_related_entries}
{
/exp:weblog:entries}
</table

Now, for some reason the total comments do not update.. only some times it works once then does not update anymore.

I have tried Utilities - > Recount.. but it works sometimes but not others..
Is there something I can do?

 
Posted: 22 September 2008 10:02 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2002-05-20
12643 posts

It’s the use of reverse related entries- the info is being cached until manually cleared, so some dynamic info won’t be updated.  Check the docs- bottom of the page:

Important:  For performance reasons all related entry data is cached internally by the system when you submit new entries using the Publish page. This has the unfortunate side effect of making a some items that are normally dynamic not able to be used. These include various statistical variables:

{view_count_one}
{view_count_two}
{view_count_three}
{view_count_four}
{expiration_date }
{comment_expiration_date}
{recent_comment_date}
{comment_total}
{trackback_total}

If you go to ‘Admin- Utilities’ and clear all cached data, that gets them showing current- correct?  However- related data is only cleared manually.  I’m not thinking of a great way around it.

 Signature 
 
Posted: 22 September 2008 10:22 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2008-01-30
23 posts

Thanks Robin,

Does this mean that I have to figure another way of doing this or can you see a work around?

 
Posted: 22 September 2008 10:44 AM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2002-05-20
12643 posts

It’s hard to say w/out fully understanding the setup.  For example- I’m not dead sure why you need to use relationships.  Are the replies comments?  Or are they new entries- related to the ‘main’ entry?  So- two options come to mind- don’t use relationships.  Just use the entry/comments.  Or use categories/entries.

The other option- you could likely write some script to clear the cache for the given relationship whenever a new ‘reply’ is made.

Like I say- can’t determine how I’d go at it w/out knowing the whole setup.  But does the above help?

 Signature 
 
Posted: 22 September 2008 11:06 AM   [ # 4 ]   [ Rating: 0 ]
Joined: 2008-01-30
23 posts

Hi Robin,
Yeah I guess you are correct. All can be achieved with just the basics of entry/comments.

We learn something new each day about EE!
smile

Thank you for your help again.

 
Posted: 22 September 2008 11:13 AM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2002-05-20
12643 posts

wink  No problem.  I do think that’s the easiest way to go.  Unless there’s something else going on, it’s the approach I’d take.

 Signature