Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
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
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
Re: Plugin idea: Word Count?
except this plugin will count html and some textile markup as words.
Offline
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
Re: Plugin idea: Word Count?
oooooooooooh – a new toy :) :) :)
thanks ramanan!
Offline
Re: Plugin idea: Word Count?
Ok, we’ve got word count… How about Image count…?
Lumilux – A Photoblog
Offline
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