Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2014-02-20 09:15:57

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

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

Thanks Stef,

The plugin worked like a charm. No other plugin was needed


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#38 2014-08-28 15:20:17

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

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

Hello Stef, ‘cause I’m using Claire’s Swap Body Excerpt your plugin show the number of words in the “wrong” way (first the body words and then the excerpt words).
So, I know, it’s not your fault… hehehe… :P but, can you add a function to swap the counters?

EDIT: didn’t notice the Advanced Prefs: it’s already possible!

The best would be an auto-check if Claire’s plugin is activated and perform as a result… ;)-

… and even the possibility to localize the plugin (“word/s” => “parola/e” in Italian) even in the interface (“Article Stats” => “Statistiche”)

Thank you!!!

Last edited by candyman (2014-08-28 15:40:19)

Offline

#39 2014-08-28 16:00:45

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

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

candyman

Glad to be of service :-)


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

#40 2018-03-04 11:55:39

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

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

If there is already a thread for this, the forum is having hella hard time finding it. If so, please point me accordingly and I’ll clean up.

But… I have it installed in 4.7dev and have the front-side tag set like this at top of the article in the same p as the post date:

<txp:smd_article_stats item="body, excerpt" type="word" label="words: " labeltag="b" />

The back-end “Article stats” say, probably accurately: 2227 words ( 2107 / 120 )
But the front-side output says, words: 1991119.

I’m guessing that should be the sum of 1,991 + 119 (the desire) but isn’t getting processed, and the numbers are off.

Franky, I don’t care if the counts are off by a few words, but that’s more than a few. And the summation is troubled.

Stef’s response from a different thread soon to be deleted:

You might want a break=" + " attribute to separate the items :-)

As for the disparity in counts, well, it’s tricky. I think the plugin counts the body text typed on the admin side, which may include tags and headings and Textile codes and stuff. But on the public site, it only counts the rendered HTML, minus tags. So depending how much markup you use there may be some differences. A few hundred words seems a lot, though!

EDIT: I just found an article with over 9K words in it and the difference between public and admin counts was 10 words – that accounted for the ‘h2.’ tags in the admin side body text. Do you have a lot of Textile markup in your article body?

EDIT 2: The plugin doesn’t (currently) do sums. But if you’re running 4.7 you could maybe find a way to run the output through <txp:evaluate> to do the maths.

Thanks!

Offline

#41 2018-03-04 12:01:59

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

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

Destry wrote #309624:

there’s no way to get a total sum on the count as a option?

Not currently, it doesn’t do sums. I could probably add that – and it needs an overhaul for the changes in 4.7 prefs anyway so it’s a good time to add it.

In the meantime can you run it or any part of the tag through the evaluate tag:

<b>Words:</b> <txp:evaluate query='<txp:smd_article_stats item="body, excerpt" break="+" />' />

?


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

#42 2018-03-04 12:06:26

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

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

Wundibar!

Never used the evaluate tag before. Works as prescribed. Thanks, maestro!

Offline

#43 2018-03-04 12:13:18

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,227
Website

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

Destry wrote #309629:

Never used the evaluate tag before

Study it, cherish it, as it is truly magic.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#44 2018-03-04 12:14:39

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

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

Oh, in case you missed it above, I have a bunch of endnotes/annotations with some rather complex markup that was causing the wide count difference in the body. I’d overlooked that.

Offline

#45 2018-03-04 12:43:48

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

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

Stef, I forgot to mention…

In the admin-side I have the “Article stats” under the excerpt box, which is where I like it for now (who knows when the unlimited custom fields utopia arrives). But I notice that when set as the default, “Above Sort and display”, there’s no output. Or it’s probably hidden under the Save box that’s fixed in that position in Hive admin theme. Just to mention it.

Offline

#46 2018-03-04 13:05:15

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

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

Destry wrote #309638:

“Above Sort and display”, there’s no output. Or it’s probably hidden under the Save box that’s fixed in that position in Hive admin theme. Just to mention it.

Good point. Yeah, either the DOM hooks have changed or it’s obscured. I’ll fix that in the 4.7 release, thanks.


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

#47 2018-03-04 13:07:41

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,227
Website

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

Bloke wrote #309640:

Good point. Yeah, either the DOM hooks have changed or it’s obscured. I’ll fix that in the 4.7 release, thanks.

here


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#48 2018-03-04 14:04:00

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

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

phiw13 wrote #309641:

here

Good memory :-) I’ll fix that, honest.


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

Board footer

Powered by FluxBB