Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; StringReader has a deprecated constructor in /home/mobiusse/public_html/pivotx/pivotx/includes/streams.php on line 48

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; FileReader has a deprecated constructor in /home/mobiusse/public_html/pivotx/pivotx/includes/streams.php on line 84

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; CachedFileReader has a deprecated constructor in /home/mobiusse/public_html/pivotx/pivotx/includes/streams.php on line 144

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; EntriesFlat has a deprecated constructor in /home/mobiusse/public_html/pivotx/pivotx/modules/entries_flat.php on line 25

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; PagesFlat has a deprecated constructor in /home/mobiusse/public_html/pivotx/pivotx/modules/pages_flat.php on line 20
Möbius HTML Design

Blog Stats

05 Jun 2011
22:59

Count Entries and Comments per Category and/or User


Extension Blog Stats is used to count the entries and comments per category and author. It is a highly configurable extension allowing you to format the output however you please.

In reality, this extension is a conversion of a PivotLog extension by Bram Nijmeijer (formerly known as Tenshi) called Total Posts (rewritten, updated, and released with his permission). It does essentially the same thing, plus a few other features have been added. The usage has been changed slightly, too.

Current Version Information
  • Extension Version: 1.4.1
  • Release Date: 2014-02-14
Download
  • blogstats.zip
  • Unpack the file, and place the /blogstats directory in your ~/pivotx/extensions directory. Then, navigate to the Extensions tab of your PivotX to enable it.
Snippet Syntax

The minimial usage is:

[[ blogstats cat_format="some html" ]]
or
[[ blogstats user_format="some html" ]]

"Some html" would be replaced by a line of html depicting how the ouput is to be formated. See below for more details.

The snippet takes one required parameter - cat_format or user_format. If either of these parameters is not set, there will be no output. Both of these parameters can be used at the same time.

  • cat_format - html format for the output, counting entries and comments in categories. The cat_format line is repeated for each category that is included (via cat_include), not ignored (via cat_ignore), or every non-hidden category (if cat_include and cat_ignore are not used). In cat_format, the following items are parsed:
    • %category% - display name of the category.
    • %cat-link% - simply a link to the category (snippet does not build the anchor tag).
    • %entries% - number of entries in the category.
    • %comments% - number of comments in the category.
    • %trackbacks% - number of trackbacks in the category.
    • %isactive% - snippet of html code inserted for a category that is active.
    cat_format is not required if totalonly is turned on.
  • user_format - html format for the output, counting entries (and comments in those entries) per user. The user_format line is repeated for each user that is included (via user_include), not ignored (via user_ignore), or every user (if user_include and user_ignore are not used). In user_format, the following items are parsed:
    • %user% - display name of the user.
    • %user-link% - simply a link to the user's entries (snippet does NOT the anchor tag).
    • %entries% - number of entries authored by user.
    • %comments% - number of comments in the entries authored by user.
    • %trackbacks - number of trackbacks in the entries authored by user.
    user_format is not required if totalonly is turned on.

Additionally, the snippet takes nine optional parameters:

  • prefix / postfix - html format for the first / last line(s) of the output. The format can display the total number of entries and comments, either for the specified categories/users or across all categories/users (depending on the setting of fulltotal). In the format, the following items are parsed:
    • %entries% - sum total number of entries in the specified categories or across all categories (depending on the setting of fulltotal).
    • %comments% - sum total number of comments in the specified categories or across all categories (depending on the setting of fulltotal).
    • %trackbacks% - sum total number of trackbacks in the specified categories or across all categories (depending on the setting of fulltotal).
  • cat_prefix / cat_postfix - html format for the first / last line(s) of the output specifically for category output (before / after cat_format).
  • cat_include - comma separated list of categories to be included in the stats gathering. Use the PivotX internal category names, not the display names. If you use cat_include, the order in which you list the categories is the order in which they will be displayed in the output, unless you specify an order using sort.
  • cat_ignore - comma separated list of categories to be ignored in the stats gathering. It may be easier to list a couple of categories to ignore than several categories to include. The order of the displayed categories is determined by the parameter sort (defaulted to pivotx).
    • NOTE: hidden categories are automatically ignored.
    • NOTE: cat_ignore overrides cat_include.
  • user_prefix / user_postfix - html format for the first / last line(s) of the output specifically for user output (before / after user_format).
  • user_include - comma separated list of users to be included in the stats gathering. Use the PivotX internal user names, not the display names. If you use user_include, the order in which you list the categories is the order in which they will be displayed in the output.
  • user_ignore - comma separated list of users to be ignored in the stats gathering. It may be easier to list a couple of users to ignore than several users to include. The order of the displayed users is determined by the order in which they are encountered internally by the extension.
    • NOTE: if a user has no entries in the included categories (cat_include), the non-ignored categories (cat_ignore), or the non-hidden categories, there will be no data output for them.
    • NOTE: user_ignore overrides user_include.
  • year - limits the counting of entries and comments to the specified year (use four-digit year).
  • month - further limits the counting of entries and comments to the specified month (use two-digit month; e.g., 02 = February).
    • NOTE: the parameter year is required for use with month.
  • sort - order in which you would like the list of categories displayed. These are the choices:
    • pivotx or pivotx-rev - ordered as found in the PivotX configuration, either the same or in reverse.
    • alpha-asc or alpha-desc - ordered alphabetically by name, either ascending or descending.
    • entries-asc or entries-desc - ordered according to the number of entries each category has, either ascending or descending.
    • comments-asc or comments-desc - ordered according to the number of comments each category has, either ascending or descending.
    • tracks-asc or tracks-desc - ordered according to the number of trackbacks each category has, either ascending or descending.
    The default ordering method is pivotx, unless the parameter include is used. If the parameter include is used, the display order can still be specified using sort.
  • fulltotal - determines whether or not the total number of entries and/or comments across all categories will be displayed regardless of the categories included or ignored. The default is not to use fulltotal. fulltotal=1 turns it on.
  • totalonly - if you only want to display the total number of entries and/or comments, turn this on. format is no longer required with this parameter on, but either prefix or postfix are. The default is not to use totalonly. totalonly=1 turns it on.
  • usersfirst - if you display information for both categories and users, by default, the output for categories is displayed first. If you want the output for users displayed first, turn this parameter on. usersfirst=1 turns it on.
Changelog
  • version 1.0 released on 23 February 2010
  • version 1.1 released on 3 March 2010
    • use of different functions (in the class Categories), makes things more stable [hansfn]
    • use of makeCategoryLink for creation of links to category display [hansfn]
    • prefix/postfix are optional [hansfn - though this was a change planned by Stingray]
    • hidden categories are now ignored [hansfn]
    • streamlined/corrected counting of total entries and comments [hansfn]
    • changed sort methods pivot/pivot-rev to pivotx/pivotx-rev [hansfn]
    • added parameter 'totalonly' so that only the total entries and/or comments is displayed
    • bug fix: what if sort method is invalid setting? [hansfn]
    • bug fix: format would not display information if only one category included [hansfn]
    • bug fix: if hidden category in include, would still output a format line (though would not include count data)
  • version 1.2 released on 18 March 2010
    • new feature: can count entries per author (and comments in those entries), including a link to users' entries.
    • added a slew of new parameters (some related to new feature): user_include, user_ignore, cat_prefix, cat_postfix, user_prefix, user_format, user_postfix, usersfirst
    • changed a few parameters to match new parameters: include -> cat_incude, ignore -> cat_ignore, format -> cat_format
    • isactive parameter added: allows stylizing the currently active category or categories
  • version 1.2.1 released on 19 March 2010
    • corrected the documentation, which didn't save the updates I made to it yesterday
  • version 1.3 released on 6 June 2011
    • bug fix: display 0 for categories or users with 0 entries or 0 comments
  • version 1.4 released on 12 December 2012
    • removed (commented out) the use of a function no longer in use in PivotX. It seems to be unnecessary to the snippet, anyway.
    • counts trackbacks. Why did it take so long? Along with this is added the ability to sort the listing according to trackbacks as with comments.
    • bug fix: invalid foreach triggered by entries not in a category (Harm).
  • version 1.4.1 released on 14 February 2014
    • bug fix: $PIVOTX['db'] breaking some PivotX smarty tags.


Powered by PivotX - 2.3.10 Gravatars: Globally Recognized Avatars XML: RSS Feed XML: Atom Feed
Valid XHTML 1.0 Transitional Valid CSS 2.1
© MMX Möbius HTML Design Möbius HTML Design
Möbius Hosting Services Möbius Hosting Services