Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2004-05-17 18:08:33

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

Re: Plugin idea: Word Count?

Hey, sorry for not replying earlier.

I think it would be a bit more tricky to do. Off the top of my head, I can’t think of a way to do it that wouldn’t involve iterating through all your posts and counting the words in each post. The plugin would have to do something like select all the posts your made from your database, and count all the words in each one. It might slow things down a lot.

It would be better if the word count was maintained as a statistic when you save an entry in the database. Then retrieving the word count would be simple, and retrieving the total word count would also be simple.

I’ll try doing something anyway.

Offline

#14 2004-05-17 22:34:50

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

Re: Plugin idea: Word Count?

Cool beans, thanks!

Offline

#15 2004-05-19 02:01:10

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

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

#16 2004-05-19 02:32:39

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

Re: Plugin idea: Word Count?

Sweet, thanks Radley and ramanan.

Offline

#17 2004-09-12 03:09:34

nishark
New Member
From: Melbourne, Australia
Registered: 2004-06-02
Posts: 9
Website

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

#18 2004-09-12 05:50:56

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

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

#19 2004-09-12 06:04:17

nishark
New Member
From: Melbourne, Australia
Registered: 2004-06-02
Posts: 9
Website

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

#20 2004-09-14 07:07:54

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

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

#21 2004-09-15 17:47:42

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

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

#22 2004-09-22 01:38:33

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

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

Board footer

Powered by FluxBB