Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-05-09 23:10:48

spyke
Member
From: Denmark
Registered: 2004-04-21
Posts: 14
Website

Plugin idea: Word Count?

Ok, just a TOY, but boys will be boys =)

I’d love to be able to have a word count in my posts

Offline

#2 2004-05-09 23:12:36

LisaJill
Member
From: White Plains, NY
Registered: 2004-04-26
Posts: 16
Website

Re: Plugin idea: Word Count?

Oooooh, me too, me too. Isn’t there a word count function in php? I wish I could code. :(

Offline

#3 2004-05-09 23:23:10

jason
Member
From: USA
Registered: 2004-02-23
Posts: 85
Website

Re: Plugin idea: Word Count?

that’s easy enough to do. strip away html (which txp probably already has a function doing it) and use str_word_count

i might have some time next week to write a 5 minute plugin (but someone can feel free to beat me to it).

Offline

#4 2004-05-09 23:51:12

spyke
Member
From: Denmark
Registered: 2004-04-21
Posts: 14
Website

Re: Plugin idea: Word Count?

> jason wrote:

> that’s easy enough to do. strip away html (which txp probably already has a function doing it) and use str_word_count

i might have some time next week to write a 5 minute plugin (but someone can feel free to beat me to it).

—————-

Or maybe it’s possible to define $string as the Body column of textpattern in the db (and not Body_html so the html wouldn’t need to be stripped?

I’m not too good with getting info from mysql yet, just trying to figure out how to make

< ?php
$str = “POSTBODY”;
$wordcount = str_word_count($str);
echo $wordcount;
? >

Last edited by spyke (2004-05-10 00:07:59)

Offline

#5 2004-05-10 01:20:22

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

Re: Plugin idea: Word Count?

Done. Let me know if there are any problems.

Last edited by ramanan (2004-05-10 01:26:05)

Offline

#6 2004-05-10 01:31:18

LisaJill
Member
From: White Plains, NY
Registered: 2004-04-26
Posts: 16
Website

Re: Plugin idea: Word Count?

thanks rama, going to test it now =)

[edit]: works purrfectly, thank you rama. =)

Last edited by LisaJill (2004-05-10 01:40:28)

Offline

#7 2004-05-10 02:15:30

PeterS
Member
From: Cleveland, Ohio
Registered: 2004-03-06
Posts: 38
Website

Re: Plugin idea: Word Count?

First plugin I’ve installed, and it works like a champ. Thanks ramanan!


The following is true
The above statement is false.

Offline

#8 2004-05-10 04:38:16

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: Plugin idea: Word Count?

except this plugin will count html and some textile markup as words.

Offline

#9 2004-05-10 05:15:30

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

Re: Plugin idea: Word Count?

Yep. I can spend some time trying to get a more exact count, but as it stands the plugin right now took 10 odd minutes to write. Maybe. I think for most people the results it spits out will be accurate enough.

I imagine the only useful purpose for a plugin like this would be to display excerpts, with a word count of the whole article, so people can decide if they have the time to read the whole article or not. I don’t see why anyone would need to know exactly how many words are in a post.

That said, does anyone need a more exact word count? If so, let me know. I could probably add some regular expressions that would turn anything between < > into nothing, and similarly turn all the textile shorthand into nothing, before the word count is done. It just seems like more work for not much real gain to me. Even then, this method wouldn’t be 100% exact either.

Last edited by ramanan (2004-05-10 05:19:05)

Offline

#10 2004-05-10 08:18:23

spyke
Member
From: Denmark
Registered: 2004-04-21
Posts: 14
Website

Re: Plugin idea: Word Count?

oooooooooooh – a new toy :) :) :)

thanks ramanan!

Offline

#11 2004-05-16 02:34:35

Hans
Member
From: Everywhere
Registered: 2004-03-07
Posts: 99
Website

Re: Plugin idea: Word Count?

Ok, we’ve got word count… How about Image count…?


Lumilux – A Photoblog

Offline

#12 2004-05-17 13:42:29

valdok
Member
From: Chicago
Registered: 2004-03-14
Posts: 31
Website

Re: Plugin idea: Word Count?

I’d love a plug-in that counted the total number of words for an author, or even better, an entire blog. Is that possible, ramanan? By the way, I appreciate all the effort with the MT import script and all the groovy plug-ins you’ve made.

Offline

Board footer

Powered by FluxBB