Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2004-09-22 03:27:14

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

Re: Plugin idea: Word Count?

I’ve uploaded the copy on my computer now (I regenerated the text file just to be safe). It’s there now. Let me know if there are still problems.

Offline

#26 2004-09-22 04:55:51

kelp
Archived Plugin Author
From: Seattle WA
Registered: 2004-07-05
Posts: 20
Website

Re: Plugin idea: Word Count?

> ramanan wrote:

> I’ve uploaded the copy on my computer now (I regenerated the text file just to be safe). It’s there now. Let me know if there are still problems.

This one for sure has the code, but when I replace the rsx_word_count tag with rsx_total_word_count it doesn’t return anything.

I’m just putting <txp:rsx_total_word_count /> in my default page template, but it returns nothing.

However <txp:rsx_word_count /> does work great for me.

Thanks!

Last edited by kelp (2004-09-22 04:57:14)

Offline

#27 2004-09-22 05:01:10

kelp
Archived Plugin Author
From: Seattle WA
Registered: 2004-07-05
Posts: 20
Website

Re: Plugin idea: Word Count?

Ohh! I got it to work. I realized that I’m using custom table prefixes. So I just had to change the table name to match so the select statement actually worked.

Now it looks good!

Thanks much! Very cool little plugin. :)

Offline

#28 2004-09-22 05:52:58

kelp
Archived Plugin Author
From: Seattle WA
Registered: 2004-07-05
Posts: 20
Website

Re: Plugin idea: Word Count?

One more thing on this…

<txp:rsx_total_word_count /> actually returns the total number of characters in all articles, not the total number of words.

I don’t know SQL or php well enough to hack it to output the total number of words, at least not quickly.

Still trying to figure it out. I may just get it :)

Offline

#29 2004-09-22 06:04:15

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

Re: Plugin idea: Word Count?

Damn! You’re quite right. I can’t believe nobody noticed sooner.

Offline

#30 2004-09-26 11:20:58

fantasylit
New Member
From: Australia
Registered: 2004-09-24
Posts: 2
Website

Re: Plugin idea: Word Count?

Umm….I’m going to sound like such a geek here. I’m doing Nanowrimo ( http://www.nanowrimo.org ) this year. The premise is that you write a 50K word novel in a single month. Obviously, the important point here is that you need to do a minimum of 50K real words (not including tags, of course). I was planning on blogging the entire (appalling) novel, so I would love to have an exact word count for each day of my blogging to stay on target. If you can do it, ramanan, I would love to use txp for my nano blog! :)

Carla


I Elaborate
http://www.ielaborate.info

Offline

#31 2004-09-27 00:46:50

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

Re: Plugin idea: Word Count?

I can’t think of a fast way to do it, like a simple sql statement or something. You could select out all the entries and then cycle through them, but that seems slow. I’ll think about it more when i get the chance. Anyone else know how to tackle the problem.

Offline

#32 2004-10-23 00:28:14

kennethlove666
Member
From: arkansas
Registered: 2004-04-27
Posts: 107
Website

Re: Plugin idea: Word Count?

any update on the total word count mode? i’d love this for the same reason (nanowrimo).


Listen to Kenneth

Offline

#33 2004-10-23 14:02:07

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

Re: Plugin idea: Word Count?

Sorry guys. Now that I’ve started work I’m much slower and getting stuff done. I think it would be slow to process this on the fly. (In my head, the only way I see to do this dynamically would be to select out all your articles, and iterate through them all summing up the word count.) If there was a way to do this in SQL it would be ideal.

Offline

#34 2004-10-23 16:22:36

kennethlove666
Member
From: arkansas
Registered: 2004-04-27
Posts: 107
Website

Re: Plugin idea: Word Count?

well, since all the articles would be posted to one section, couldn’t it do the count whenever an article is published to that section, and just update the # in the db or a flatfile?


Listen to Kenneth

Offline

#35 2004-10-23 17:40:25

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Plugin idea: Word Count?

I know that similar versions of this have been made for Wordpress and Movable Type. Perhaps looking at some of those would give some inspiration.

Last edited by compooter (2004-10-23 17:55:07)

Offline

#36 2004-10-23 18:04:30

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Plugin idea: Word Count?

I’m looking at the current code,

<pre>
function rsx_total_word_count($atts) { return getThing(“select sum(length(body)) from textpattern”);
}
</pre>

Length() totals all chars of the string, not what we want, and mySQL queries are just gonna complicate things. Why not just use the same technique that’s in rsx_word_count() but with all of body in textpattern?

<pre>
function rsx_total_word_count($atts) { $all_content = getThing(“select body from textpattern”); return count(explode(” “, $all_content));
}
</pre>

NOTE: this hasn’t been tested. Just blue-skying here.

Also as a sidenote: this could be extended with an optional ‘from’ and ‘to’ attribute, using strtotime, so that you could limit the selection to a certain timespan or from a certain starting date. Anyone see any flaws in this approach?

Last edited by compooter (2004-10-23 18:09:46)

Offline

Board footer

Powered by FluxBB