Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Plugin idea: Word Count?
What? That’s wicked good. Alright then, I will add that to my word count plugin then. I didn’t know there was a length function in SQL.
Update: I’ve updated my plugin to use the sql code posted above. So now there is a total word count tag.
Last edited by ramanan (2004-05-19 02:25:47)
Offline
Re: Plugin idea: Word Count?
Sweet, thanks Radley and ramanan.
Offline
Re: Plugin idea: Word Count?
Hi there,
Following is a form template of type article:
<code>
<div class=“entry”>
<span class=“date”><txp:posted /></span>
<h3>
<txp:permlink><txp:title /></txp:permlink>
</h3>
<p><txp:excerpt /></p>
<p class=“entry_footer”>
<txp:permlink>Read more …</txp:permlink> [<txp:rsx_word_count />] | <txp:comments_invite />
</p>
</div>
</code>
I am trying to display the number of words in an article after the excerpt. All I’m getting is “Read more … []”.
What am I doing wrong?
Let me know if more info is required.
ta
Offline
Re: Plugin idea: Word Count?
When you go to the plugin page, make sure that the plugin is active. There is a yes/no thing that tells you whether the plugin is in use or not. That might be the problem.
Offline
Re: Plugin idea: Word Count?
Yes of course!
Silly me! You would’ve thought I’ll figure that out. Specially since this is my third plugin! Oh well, having a slow Sunday I suppose.
Thanks Ramanan, your plugin is working fine.
Offline
Re: Plugin idea: Word Count?
ramanan is the version of your plugin with Radley’s SQL addition the one you link to here ?
Because I don’t see any SQL in the code for that plugin. Unless I’m really confused, not being very adept at php and textpattern plugin writing.
Thanks!
Offline
Re: Plugin idea: Word Count?
Yep. That should be the one. There should be two tags that you can use. <txp:rsx_word_count /> and <txp:rsx_total_word_count />.
Offline
Re: Plugin idea: Word Count?
> ramanan wrote:
> Yep. That should be the one. There should be two tags that you can use.
> <txp:rsx_word_count /> and <txp:rsx_total_word_count />.
Hmm, I don’t see it.
I’m looking at this: http://www.funkaoshi.com/static/rsx_word_count.txt
And the code in it is:
function rsx_word_count($atts) { global $thisarticle; $wordcount = count(explode(” “, $thisarticle[‘body’])); return $wordcount; }
Should be more right?
Thanks!
Offline
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
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
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
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
Re: Plugin idea: Word Count?
Damn! You’re quite right. I can’t believe nobody noticed sooner.
Offline
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