How tod Add "Last 20 Recent Comment" in Summary Templates

How tod Add "Last 20 Recent Comment" in Summary Templates

Postby Logan on Sat Jun 14, 2008 12:57 am

Hello friends, I thinking to add the last 20 comments of all Blogs In the Index file of Summary Templates ??

Have an Idea. ??

Thanks
Logan
 
Posts: 8
Joined: Sun May 11, 2008 8:23 pm
LifeType Version: 1.28

Re: How tod Add "Last 20 Recent Comment" in Summary Templates

Postby jondaley on Sat Jun 14, 2008 9:05 am

I think people have talked about that before, so you might search around on the forums a bit.
But, otherwise, you'll want to edit: class/summary/dao/summarystats.class.php and add a function, presumably copying from the getRecentArticles() or something like that.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: How tod Add "Last 20 Recent Comment" in Summary Templates

Postby Logan on Sat Jun 14, 2008 5:07 pm

Im searching the Topic, but I cant search any answer.-
Logan
 
Posts: 8
Joined: Sun May 11, 2008 8:23 pm
LifeType Version: 1.28

Re: How tod Add "Last 20 Recent Comment" in Summary Templates

Postby jondaley on Sun Jun 15, 2008 7:17 am

I thought about this some more, and I almost thought it was going to be really easy, but I forgot that things changed in 1.2, where the articles "cache" how many comments there are, to make some queries quicker.

So, it depends on what you want - ie. do you want to show comments if the blog has been set to not show in the summary, or if the article isn't published, etc.

A simple query is just:
Code: Select all
 $query = "SELECT * FROM {$prefix}comments ORDER BY date DESC LIMIT 0, $max";                   


(edit the query in getMostCommented to test it out)
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Templates

cron