Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Plugin idea: Word Count?
Wait wait wait. All this time there has been a php function called str_word_count
?
Offline
Re: Plugin idea: Word Count?
Yep :)
And it might do an pretty good job if the input is run through strip_tags() and then all things that look like html entities are striped out with something like preg_replace().
I was just too lazy and non regex clued to strip out all the html entities.
Offline
#51 2004-11-05 03:19:14
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Plugin idea: Word Count?
You know, I had noticed that yesterday as well while browsing string functions, but had just assumed there was a logical reason everyone had passed it up. D.Oh.
Offline
Re: Plugin idea: Word Count?
Oooer! Who knew I could cause so much trouble!
I’ve noticed that I tend not to use many tags so ramanan’s plugin is pretty accurate. Its only been a few words out for each post so far (I checked in a couple of regular word processors).
And thanks again for writing it, ramanan – its really come in handy.
Carla
I Elaborate
http://www.ielaborate.info
Offline
Re: Plugin idea: Word Count?
> ramanan wrote:
> Wait wait wait. All this time there has been a php function called str_word_count
?
hehe, that function is mentioned in both the 3rd and 4th posts in this thread :)
Offline
#54 2006-08-02 02:29:05
- datumax
- Member
- Registered: 2005-01-12
- Posts: 16
Re: Plugin idea: Word Count?
Sweet! But has anyone thought to, or is it possible to use the output of this plugin dictate behavior? Like…
If wordcount >= 200
then truncate post
Can we build around this?
Offline