Textpattern Forum

You are not logged in. Register | Login | Help

#61 2009-03-06 17:47:33

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 271
Website

Re: mdn_count

Hi

Try ….

<txp:variable name=“article_count” value=“0”/>
<txp:article_custom form=“article_count” limit=“1000000” />

with

<txp:adi_calc name=“article_count” add=“1”/> as the one line in form “article_count”

You can then use all the possible combinations of article_custom

Geoff


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#62 2010-10-30 11:43:23

b2872387
New Member
Registered: 2010-10-30
Posts: 1

Re: mdn_count

This is such a simple but useful plugin. There are a couple of other plugins that will let you so queries on the DB, but there’s not point having such a complex plugin when all you want to do is a quick article count.

Its strange this isn’t core functionality yet. There’s comment count and search result count, but no article count.

Offline

#63 2010-10-30 11:43:39

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

mdn_count

Version 2.2 – updated 2013-09-09.

I am not the original author, but I use this plugin and when I updated to the 4.3.0 RC it no longer worked, so I gave it a quick do-over.

<txp:mdn_count section=" sectionname " category=" categoryname " status=" 1,2,3,4,5 " time=" now,past,future " customfield=" my,custom,fields " customvalue=" custom,field,values " debug=" true " />

  • Using the tag without any attributes will return a count of all articles that are both live and current (not expired or future).
  • Specifying a section or a category will show a count of articles in that section/category.
  • Specifying both a section and a category will show articles in the intersection of the two criteria.
  • The status attribute defaults to 4 (live), and also accepts 1 (draft), 2 (hidden), 3 (pending), and 5 (sticky) – please use the numbers only.
  • The time attribute defaults to now, and also accepts past and future – new in v2.1.
  • The customfield and customvalue parameters need to be used together, and will further restrict the count to articles with custom fields that contain only a certain value.
  • Setting debug to true will show the query being run in the form of a HTML comment.

All attributes are both optional and accept multiple values (in the form of a comma separated list, with the exception of debug).

Plugin originally by Mark Norton, v2.0+ rewritten by me :)

Tested on 4.2.0 and 4.3.0, but should work on all versions of Textpattern.

Please let me know if you find any bugs.

Cheers,
cain-mi

Last edited by cain-mi (2013-10-10 05:30:32)

Offline

#64 2010-10-30 13:54:23

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: mdn_count

Thanks. I’m glad there’s still a point to it, but I’m just not doing any web work anymore at the moment. The txp-dev listserv has been pretty active and seems receptive of late to modifications. If it’s believed this should be core functionality, you might submit the working version to them, see what arises.

Offline

#65 2010-10-30 16:15:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,821
Website

Re: mdn_count

cain-mi wrote:

Version 2.0 – completely rewritten 2010-10-30.

Remillard wrote:

Thanks. I’m glad there’s still a point to it, but I’m just not doing any web work anymore at the moment.

Hi Mitch, since Mark is not working on the plugin anymore, maybe a new thread for your modified plugin should be opened?

Last edited by colak (2010-10-30 16:16:32)


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#66 2010-10-31 01:26:56

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

colak wrote:

Hi Mitch, since Mark is not working on the plugin anymore, maybe a new thread for your modified plugin should be opened?

I thought about that, but seeing as this plugin doesn’t have a huge following (only a couple of posts in this thread in the last two years), there was no point fragmenting it. Els added a note on the OP linking to my updated one, and I added a comment on the TXP Resources listing, so hopefully everyone will be able to work out what’s going on.

Offline

#67 2010-10-31 02:16:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,821
Website

Re: mdn_count

cain-mi wrote:

I thought about that, but seeing as this plugin doesn’t have a huge following (only a couple of posts in this thread in the last two years), there was no point fragmenting it.

I’m using the plugin:) Maybe the inactivity lies in its not having any problems:) i’ll be downloading yours very soon. Thanks for adopting it.


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#68 2010-10-31 02:18:57

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

colak wrote:

Maybe the inactivity lies in its not having any problems:)

You could well be right there :)

Offline

#69 2010-11-05 03:31:45

Bill Grimm
New Member
From: Colorado
Registered: 2010-01-25
Posts: 8

Re: mdn_count

Is there a way to only count the articles in a given category that have not expired?

Offline

#70 2010-11-05 05:57:37

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

Hi Bill,

Excellent point – I’ve updated the plugin so that by default articles are only counted if they are both live and current (i.e. not expired and not in the future).
Please give it a crack and let me know how it goes.

For anyone depending on counting expired or future articles as well, there is a new time tag – check the main post for details.

Cheers,
cain-mi

Last edited by cain-mi (2013-10-10 05:32:10)

Offline

Board footer

Powered by FluxBB