Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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,311
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
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
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
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
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 if
s? F&*k it, I’ll bosh it in.
Ta very much.
Offline
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
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