Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-07-26 19:52:27

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

rsx_request_count: Article Request Counter

I’ve written a Textpattern plugin to count the number of times an individual article is requested. This isn’t the most accurate way to gauge the popularity of an article, but it is probably the simplest. The plugin updates the count, and returns the number of times an article entry has been requested.

From the help:

This plugin will let you keep tabs on the number of times an article is requested. Every time a user requests to read an individual article, a counter in the database is incremented. You can do whatever you want with the value returned, or choose not to display anything at all.

To use the plugin, begin by running the following SQL statement to add a new column to the textpattern table: ALTER TABLE 'textpattern' ADD 'request_count' INT DEFAULT '0' NOT NULL;. Next, place the <txp:rsx_request_count /> tag in an article form you use
to post articles on your site.

If you do not want the tag to return any value, you simply want to keep track of the information in the database, use the noshow option—i.e use the following tag <txp:rsx_request_count no_output="1"/>

If you want to use the plugin, download this file: rsx_request_count.txt

Last edited by ramanan (2004-07-29 14:58:19)

Offline

#2 2004-07-27 06:38:07

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: rsx_request_count: Article Request Counter

Hi ramanan, just an idea, but could the count be made to only show to a logged in user? Like your front end edit plugin. Also on the subject of counting, do you have anything to count/display the number of articles in a category?

Thanks for the plugins, keep them coming…

Regards, Lee.

Offline

#3 2004-07-27 07:24:48

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: rsx_request_count: Article Request Counter

I don’t want to change the plugin itself, because it is quite simple as it is, and just returning the number provides the user with the most flexibility. That said, including the following should do what you want:

<?php if ( isset($_COOKIE'rsx_frontend']) ) { ?>
... html you only to show up if the rsx_frontend cookie is set ...
<?php } ?>; ?>

You could place that in any form or page template. It should only display the stuff between the two php blocks if the cookie is set.

Number of articles in a category? I can do that.

Last edited by ramanan (2004-07-27 07:26:18)

Offline

#4 2004-07-27 07:34:37

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: rsx_request_count: Article Request Counter

> ramanan wrote:

> Number of articles in a category? I can do that.

That would be kind of you. And thanks for the code snippet.

Offline

#5 2004-07-28 01:30:14

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: rsx_request_count: Article Request Counter

Hey Lee, how exactly did you want to use the number of articles in a category plugin? Do you want it to look up the category itself? Do you want to supply a category name? Do you want it to use the category of an article or the category that may be supplied in the URL? Some combination of all of these?

Offline

#6 2004-07-28 07:35:01

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: rsx_request_count: Article Request Counter

May be something where you could specify 1 or more categories and it output an unordered list, like:
< txp : rsx_article_count category=“cat1, cat2, etc” delim=“optional” >

output could be:
Cat1 <—————-| each with it’s own class and only the category linked
(23 articles) <—-|

Cat2
(12 articles)

Etc
(3 articles)

Another option might be to supply a category and just output the number of articles.

What do you think?

Offline

#7 2004-07-28 13:18:47

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: rsx_request_count: Article Request Counter

cool. I’ll think about it more. I know Dean is already doing something like this when you click on the organize tab in textpattern.

Offline

#8 2004-07-29 09:04:50

pospel
Member
From: Ukraine
Registered: 2004-02-23
Posts: 40
Website

Re: rsx_request_count: Article Request Counter

> ramanan wrote:

>If you want to use the plugin, download this file: rsx_request_count.txt

cant download it – loads textpattern.com but not the plugin text file! :(

Offline

#9 2004-07-29 10:34:09

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: rsx_request_count: Article Request Counter

Try: <code>http://www.funkaoshi.com/blog/request-count</code>

Offline

#10 2004-07-29 10:40:45

pospel
Member
From: Ukraine
Registered: 2004-02-23
Posts: 40
Website

Re: rsx_request_count: Article Request Counter

> lee wrote:

> Try: <code>http://www.funkaoshi.com/blog/request-count</code>
When I try there to download rsx_request_count.txt I got 404 error. Seems like ramanan removed plugin for some reasons :(

Offline

Board footer

Powered by FluxBB