Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-07 03:09:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,243
Website GitHub

smd_article_stats: Article stats to count words 'n stuff

Following on from a request by Sam the plugin gets its own official support thread.

As well as allowing you to show article words count stats to visitors, v0.2 introduces an admin-side panel on the Write tab, similar to the way that zem_article_info and lam_article_info do things. The counter updates in real time and is lightning quick (I pasted in 40,000 words and it was updated almost before I had a chance to take my finger off CTRL-V). It also ignores tags in your body/excerpt, though it will count bits of PHP unfortunately.

You can also choose where you want the panel to reside by setting a hidden pref (smd_prefalizer is good for this). There are a handful of preset locations built into the plugin, from which you may choose your favourite.

Take it for a spin and see what you think.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in the thread to learn about the features.

  • 24 Aug 2009 | 0.1 | Initial release
  • 07 Nov 2009 | 0.2 | Improved counting to ignore tags and added real-time admin-side counter (both thanks speeke)
  • 22 Feb 2010 | 0.21 | Prevented error message if step mangled
  • 06 Jun 2011 | 0.22 | Added paragraph wrapper to fieldset for consistency with TXP’s layout (thanks philwareham)
  • 14 Feb 2012 | 0.23 | Fixed excerpt_below auto-update mechanism ; added author_below position

Last edited by Bloke (2012-02-14 15:50:20)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2010-03-19 04:38:01

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: smd_article_stats: Article stats to count words 'n stuff

Just if anyone’s wondering, I’m pretty sure this doesn’t play entirely well with hak_tinymce. It will show a count after an article’s been published/saved, but won’t do the live count.

Offline

#3 2010-03-19 05:02:35

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: smd_article_stats: Article stats to count words 'n stuff

floodfish wrote:

Just if anyone’s wondering, I’m pretty sure this doesn’t play entirely well with hak_tinymce. It will show a count after an article’s been published/saved, but won’t do the live count.

Because TinyMCE won’t use the regular textarea as it is what you see, what you get editor. Same with any other editor (flash, javascript, java-applet etc) that doesn’t sync input with the real textarea in real time (or use it as placeholder for the raw input or replaced markup, depeding how the chosen editor works).

With rah_textile_bar and such it will work as, rah_textile_bar for example, is not exactly WYSIWYG editor with own layer, but just something that inserts markup to the textarea when needed aka quick tags implemention.

Offline

#4 2010-12-27 16:05:20

M_i
Member
Registered: 2006-03-05
Posts: 122

Re: smd_article_stats: Article stats to count words 'n stuff

Hi-

On my site, 99% of articles are in English, but there are also some in other languages. French, Spanish, Dutch or German were no problem for this plugin, but it’s not working for Russian because of the Cyrillic alphabet.

any ideas for getting a word count on the odd Russian post?

Thanks!
- iris

Offline

#5 2010-12-27 17:11:50

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: smd_article_stats: Article stats to count words 'n stuff

On my test post it’s working with cyrillic. Do you have difficulties on the front end, the public side? If so: Are you sure you haven’t put the tag in an if/else clause or something similar?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2010-12-27 18:07:00

M_i
Member
Registered: 2006-03-05
Posts: 122

Re: smd_article_stats: Article stats to count words 'n stuff

uli wrote:

On my test post it’s working with cyrillic. Do you have difficulties on the front end, the public side? If so: Are you sure you haven’t put the tag in an if/else clause or something similar?

Hi!
Thanks for your speedy reply!

I was somehow still using an older version of this plugin. When I upgraded to 0.21, all was well again.

Thanks again!

Offline

#7 2011-01-12 19:01:29

hicks
Member
From: Portland, OR, USA (ex-UK)
Registered: 2009-05-08
Posts: 106
Website

Re: smd_article_stats: Article stats to count words 'n stuff

Stef,

Love the show. I mean, plug-in. Any chance of an <txp:smd_if_article_stats morethan="xxx"> to implement some instructions, say rss_auto_excerpt, if the article’s over a certain length? I’m using the latter plug-in, but I’d rather it didn’t do its thing if the body is only a few words over the auto-excerpt length. Know what I mean?

Thanks,

hicks.

Offline

#8 2011-01-12 19:44:42

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: smd_article_stats: Article stats to count words 'n stuff

FYI: hicks is referring to (t)his comment++


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#9 2011-01-13 09:12:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,243
Website GitHub

Re: smd_article_stats: Article stats to count words 'n stuff

hicks wrote:

Any chance of an <txp:smd_if_article_stats morethan="xxx">

Not right now, sorry. As Markus suggests, could you utilise smd_if here?

<txp:smd_if field='<txp:smd_article_stats item="body" />' operator="gt" value="100">
   <txp:body />
<txp:else />
  <txp:rss_auto_excerpt />
</txp:smd_if>

Last edited by Bloke (2011-01-13 09:13:51)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2011-01-13 17:45:05

hicks
Member
From: Portland, OR, USA (ex-UK)
Registered: 2009-05-08
Posts: 106
Website

Re: smd_article_stats: Article stats to count words 'n stuff

That’ll do the job. After all that though I’ve chosen to go the manual route on opting out of rss_excerpt with a custom field, an if_custom_field and a neat glz_custom_fields checkbox on my Write tab, but I can see your code coming in handy in other ways… though I could still use it here as an _auto_-opt-out… is there such a thing as too many ifs? F&*k it, I’ll bosh it in.
Ta very much.

Offline

#11 2011-01-13 18:23:09

hicks
Member
From: Portland, OR, USA (ex-UK)
Registered: 2009-05-08
Posts: 106
Website

Re: smd_article_stats: Article stats to count words 'n stuff

You had it switched around. Yours had it not excerpting if the word count was greater than 100. Just switched it, now it does exactly what it says on the tin:

<txp:smd_if field='<txp:smd_article_stats item="body" />' operator="gt" value="100">
  <txp:rss_auto_excerpt yah-de-yah/>
<txp:else />
   <txp:body />
</txp:smd_if>

Offline

#12 2011-06-06 09:52:05

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: smd_article_stats: Article stats to count words 'n stuff

Hi Stef,
Just a minor thing, but to be consistent with Textpattern layout shouldn’t the HTML structure be:

<fieldset>
<legend></legend>
<p></p>
</fieldset>

At the moment it’s missing the paragraph <p> tags. Makes it harder for custom admin themes to style the plugin if it’s not there.
Cheers,
Phil

Offline

Board footer

Powered by FluxBB