Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-03-03 12:51:27

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

simple plugin for counting articles

i used to use mdn_count, but it doesn’t work with 4.6.2. what you suggest?

Offline

#2 2018-03-03 14:07:54

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

Re: simple plugin for counting articles

Try reading from here and see if any of those fixes help.


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

Online

#3 2018-03-03 16:07:07

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

Re: simple plugin for counting articles

Hi Gallex

The edited version below works on one of my txp 4.6.2 sites

# Name: mdn_count v1.4 (compressed)
# Type: Public plugin
# Provides a count of the number of live articles by section or category, or both.
# Author: Mark Norton
# URL: http://mnorton.chaosnet.org
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAA81WbU/bSBD+jCX+w9SNmuTEOYSXQg2J1HLpFYkmKITrnQChjb12Vjhed3dN
iCr++82u144DtDrprtJ9snfeZ/bZmSF+t+t/k/6e76ZkTt0j6b/z3XmY3gY8T5U+v/VdkqsZ
F/qA0u5nIu5gyIXiqSFtlwK3uWCasnPguzOlMr/TmadGzgtmhMuUKo+LWIugxD0VkhUmdn23
6+2V9kMqA8EyZZmHaP9c8HuGdCBg4gIegZpRSPP5lAp9Stg9BSIUCxIUmy5B0kBbAC4gIIrG
XCy39GHK1czTdjHlgIcm5e7hPjphEbSChEh5Sx+YVLLVvJ7QB5URpahIryckvh7TGDli2Wy3
4dumAzB5yHw/puqHsloQ4Ne+MBQqWs2qwM320abzuOlsOhtRnhYRV8xWA81J42ljo9OByYxJ
qMTwn6WKpiENQXEQVOUiNVWpSlSUx2o/KxJLsZyZOeYJEWXFtuols7qXksTUt4djhUlXQcKV
1eu59scA6QauShs9t/yznE7fWrKfUUrLC8VwUAZrJLdeukGY51LBlGLsQZJj5tYCKxJXJPYA
TiNzyZgoBZnRgEWMhltaoJDKkjxGhQVLEqteJKJ5uqKicvwMVlQtqLWiFtwr1K0RdEsZcsSL
getgXpsg6uzSfymlY9LpKXKHbiLB58WF5kJQjNBqrvs9FzRhc5YSwajUtDjhU5JAI0NIICaP
NA2/ggSIKEtsG6pGPJO3RAiytGBrQyVqzpVcowz7VQ9cF0gaQqOK29AsUDca9SL23K5rbDw+
NdTrua9XOqX1HjTkE/kKR2sKFbXx+9now/uzi6tm0LwpVW1tTmY0uIMIK712sTp4c+de5aTO
r3x8xXDci8HZ4GQCJ6PL4aT1S9uC5eN49Blc7/zjn56rVi8fvnwajAflRfWaZV5NeD/8DduL
DbqLnPK/CaNxhYCdOqNtlKQiKpe95l5TF7IITEiMDNvOmC9kq/G1XTJsE2ihwNX2DVbE9Jib
9nfLUscjvp5VZSDPKtxXVXpF55laVjfY/mmF+uk5V8j950mXKv9B1v8THJRSq3nvw188h5CF
kHJlm+eLo9RzjS1jatOx41Qts2Kc+u62/u77LhchFZa2b2lRQmJZl0PVGU0ysxfs4WZwnPXN
qJNsniVr/brWqVej/+z0j8H6VHNe6sAoueQ5EmacS5bqSTGpob9WfGc1hYqBY/YBnIu6uy+Y
pLo6MzRRxJQJbB6ruVM515e21v+zYospZtF30jodTgbjC0TU6Wjo2KFYb1tr4G0xj3o/XIQW
OJGKqIyhcho+M7niVDDXGSkn5GhFg6EIcZ4niulLsQZkrcQ4flDnix6zzMrL1e7lIK3I1TzE
D6PJp4rZLZ5giX3vuJP1HUTBafR0YK6lryFSxU0k4Hiol9Yx7vB1FBXCG11N1JPL8XgwnLwI
7dL7sV4P+06x+8CbRB3968XnTayOnONOYVj7sdvvPDSPY3cHV+mdfRpGb/VKuntA8CeMDrrR
Xjd4153uH05xS378G95r3Yu1CwAA

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

Offline

#4 2018-03-03 16:13:07

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: simple plugin for counting articles

Or switch to 4.7 and use <txp:article_custom pgonly />.

Offline

#5 2018-03-04 08:13:05

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

Re: simple plugin for counting articles

colak wrote #309609:

Hi Gallex

The edited version below works on one of my txp 4.6.2 sites

# Name: mdn_count v1.4 (compressed)...

it counts correctly, but with errors:

Tag error: <txp:mdn_count section="talud" /> ->  Notice: Undefined variable: category while parsing form None on page default
mdn_count()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/publish/taghandlers.php:4161 parse()
if_search()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/lib/txplib_misc.php:4476 parse()
Tag error: <txp:mdn_count section="talud" /> ->  Notice: Undefined variable: category while parsing form None on page default
mdn_count()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/publish/taghandlers.php:4161 parse()
if_search()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/lib/txplib_misc.php:4476 parse()
Tag error: <txp:mdn_count section="talud" /> ->  Notice: Undefined variable: intersection while parsing form None on page default
mdn_count()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/publish/taghandlers.php:4161 parse()
if_search()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/lib/txplib_misc.php:4476 parse()

Offline

#6 2018-03-04 08:44:42

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

Re: simple plugin for counting articles

which one is correct: <txp:mdn_count [section="talud"] /> or <txp:mdn_count section="talud" /> ?

first doesn’t count and doesn’t show errors, second counts but with errors

Offline

#7 2018-03-04 08:56:18

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

Re: simple plugin for counting articles

Gallex wrote #309613:

which one is correct: <txp:mdn_count [section="talud"] /> or <txp:mdn_count section="talud" /> ?

first doesn’t count and doesn’t show errors, second counts but with errors

Hi Gallex,

The second one is correct. Does it show the error in live mode?


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

Offline

#8 2018-03-04 10:35:52

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

Re: simple plugin for counting articles

colak wrote #309614:

Hi Gallex,

Does it show the error in live mode?

no. ok, i will set it in live mode.

sorry that It does not count multiple sections or categories.

Last edited by Gallex (2018-03-04 11:17:49)

Offline

#9 2018-03-04 10:45:18

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

Re: simple plugin for counting articles

etc wrote #309610:

Or switch to 4.7 and use <txp:article_custom pgonly />.

how you would use it on section list?

<txp:section_list break="" default_title="Home" include_default="0" sections="houses,apartments,farms" wraptag="ul" class="sub">
  <li<txp:if_section name='<txp:section />'> class="active"</txp:if_section>><txp:section link="1" title="1" /></li>
</txp:section_list>

my goal is menu like this:

  • houses (5)
  • apartments (12)
  • farms (4)

Offline

#10 2018-03-04 11:56:10

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

Re: simple plugin for counting articles

etc wrote #309610:

Or switch to 4.7 and use <txp:article_custom pgonly />.

How do you make it count the number of articles. I can only make it count the number of pages on a section (list / landing) or search page.


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

Offline

#11 2018-03-04 12:08:41

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: simple plugin for counting articles

Gallex wrote #309617:

how you would use it on section list?

phiw13 wrote #309625:

How do you make it count the number of articles. I can only make it count the number of pages on a section (list / landing) or search page.

To count articles, call it with pageby="1" attribute (this will not alter the pagination). To limit the count to some sections (categories, etc), set them in <txp:article_custom /> as usual:

<txp:article_custom section='<txp:section />' pgonly pageby="1" />

Offline

#12 2018-03-04 12:11:08

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

Re: simple plugin for counting articles

etc wrote #309630:

To count articles, call it with pageby="1" attribute (this will not alter the pagination). To limit the count to some sections (categories, etc), set them in <txp:article_custom /> as usual:

<txp:article_custom section='<txp:section />' pgonly pageby="1" />...

Aha, pageby="1", that is what I missed! Thank you for the hint sir.


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

Offline

Board footer

Powered by FluxBB