Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[request] Most commented articles
As the title suggests, I’m looking for a way to display the articles which have the greatest number of visible comments.
A quick trawl of Textpattern Resources has turned up dru_chatometer, which does the basics, but aside from the fact that it doesn’t seem to notice gbp_permanent_links voodoo, I also need to be able to specify a time limit – eg. most commented articles in the last 7 days.
Does such a beast exist already?
Offline
Re: [request] Most commented articles
pieman wrote:
Does such a beast exist already?
I’m not aware of any, but you can always roll your own courtesy of the trusty ol’ smd_query:
<txp:smd_query
query="SELECT ID, title, Count(parentid) AS num
FROM txp_discuss AS com
LEFT JOIN textpattern AS txp
ON txp.ID = com.parentid
WHERE com.posted > ADDDATE(CURDATE(), INTERVAL -7 DAY)
AND com.visible = 1
GROUP BY com.parentid
ORDER BY num desc"
wraptag="ul" break="li">
<txp:permlink id="{ID}">{title}</txp:permlink> [ Comments: {num} ]
</txp:smd_query>
8o)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: [request] Most commented articles
Crumbs. smd_query really is the swiss army knife or all plugins – if you know how to handle it!
thank you
Offline
#4 2009-10-26 17:52:10
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: [request] Most commented articles
Interesting stuff, thanks, Stef!
composted … errr … added to the toolbox.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline