Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-10-26 14:05:40

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

[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

#2 2009-10-26 15:07:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

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

#3 2009-10-26 17:21:19

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

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

Board footer

Powered by FluxBB