Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-12 12:53:13

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

List most popular articles of the week/month/year?

Hi everybody,
with the help of dzd_counter_view and a simple txp:article_custom, I made a list of the most accessed (popular) articles of my blog. What I’d like to do, now, is to narrow the time range, to show just the most popular articles of the current week, month or year. Is there a way to achieve it?

I think that maybe txp:if_different could do the job, but I’m having serious troubles in understanding the way it works… :(

Thanks in advance


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#2 2008-05-12 15:38:26

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: List most popular articles of the week/month/year?

What might be important to know: dzd_counter_view changes the db value of an ordinary custom field named “countxx”, when a call to an article is made.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2008-05-12 15:49:02

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: List most popular articles of the week/month/year?

What about a combination of <txp:article_custom sort=“custom_n desc” limit=“1” /> and an if-condition via cbs_if_newer_than? Let me know!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2008-05-12 16:00:08

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: List most popular articles of the week/month/year?

uli wrote:

What about a combination of <txp:article_custom sort=“custom_n desc” limit=“1” /> and an if-condition via cbs_if_newer_than? Let me know!

Didn’t know that plugin. Thanks Uli, it sounds interesting. So txp:if_different doesn’t work for my purpose, does it?


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#5 2008-05-12 16:06:57

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: List most popular articles of the week/month/year?

vittorio wrote:

So txp:if_different doesn’t work for my purpose, does it?

I’d better not posted, so somebody would have done it by using if_different, maybe, and I’d finally have learnt to use it ;)
But who knows, perhaps my “solution” doesn’t work. There’s still a litte hope ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2008-05-12 16:45:18

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: List most popular articles of the week/month/year?

Ah… ! No, it won’t work. Ssshh…!
I didn’t consider that article_custom doesn’t check for the date an article is called, but for the date it was posted. The result would be a list of articles with entries that vanish one year/month/week after posting.
So you’d need a plugin or dash of php, that makes the relevant date entries to the database and another one, that’s capable of reading these.

Last edited by uli (2008-05-12 16:47:12)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2008-05-12 20:00:33

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: List most popular articles of the week/month/year?

If you have a very, VERY low traffic website, you might even consider abusing the built in logging facility for this, since that already stores URI + date.

Offline

#8 2008-05-13 09:31:41

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: List most popular articles of the week/month/year?

uli wrote:

I didn’t consider that article_custom doesn’t check for the date an article is called, but for the date it was posted. The result would be a list of articles with entries that vanish one year/month/week after posting.

I didn’t have time to check, but I still think it should work in combination with cbs_if_newer_than… I’ll let you know as soon as I try ;)

ruud wrote:

If you have a very, VERY low traffic website, you might even consider abusing the built in logging facility for this, since that already stores URI + date.

Thanks for your suggestion, ruud, but

  1. At the moment I DO have a low traffic website (400/600 visits per day), but I’m constantly trying to grow.
  2. I lack the skills to hack the core of txp, and I fear I could cause some irreparable error… :(

Still hoping to find an easier way, and still trying to understand how if_different works…


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

Board footer

Powered by FluxBB