Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
1.2
About It:
Get it:
Rate it:
  • Helpful?
  • 7 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

mdn_count

You heard it here first! The mdn_count plugin is used on this site and does a couple of minor things. This plugin will count the number of articles in a particular section. It will also count the number of articles with a given category (in either field 1 or 2). It returns the number. That’s it!

Currently at version 1.3. It will also count the number of articles in the intersection of section and category, and will take # as a reference to use the currently selected section or category for counting.

Usage:

<txp:mdn_count [section="sectionname"] [category="text"] />

NOTE: The items in square brackets are optional and the brackets should not be used in the construction of the tag.

    Parameters
  • section – This item is OPTIONAL. The plugin will return the number of articles in the given section name.
  • category – This item is OPTIONAL. The plugin will return the number of articles with the given category name, in either category1 OR category2.
    Notes:
  • There is some basic checking. The two parameters are optional, but it doesn’t make sense if BOTH are gone. I think that’s the only one it catches.
  • Section takes precedence over category if both are specified.

Examples:

<txp:mdn_count section="plugins" category="comments" />
will return the number of articles in the section ‘plugins’, categorized as ‘comments’

e.g.   there are 55 articles categorized in ‘comments’ in the ‘plugins’ section.

<txp:mdn_count category="conditional" />
will return the number of all articles categorized as ‘conditional’

e.g.   there are 0 articles categorized as ‘conditional’

Article Request Count:
Keywords/tags:
Initially released:
2004-11-22
Posted here:
25 Nov 2004
Article modified:
15 Nov 2006

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (4)

pfctdayelise:

the download link is dead. the one from the forum thread works: http://mnorton.chaosnet.org/files/mdn_count.txt

Mitch:

UPDATED: v2.0

Completely rewritten for TXP 4.2.0/4.3.0.

Mitch:

^^^ Correction (post was moved: v2.0 is here.

David:

Hi, I’m looking for a way to have ‘x of y articles’.

mdn_count gives me the y, but I can’t figure out how to get the x.

This is for individual article pages, between link_to_prev and link_to_next tags

Any idea how I can make this work?

I’m very new to txp; Expression Engine has {count} and {absolute_count} tags, but unless I’m in list view, I don’t think I can easily achieve the same effect with txp (but hopefully I’m wrong).

Thanks in advance

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern