|
Cookbook /
NumberOfArticlesSummary: Report the number of articles in a wiki
Version: 0.3 - 18 September 2006
Prerequisites: Last tested on PmWiki version: 2.0.6
Status:
Maintainer: wanderful
GoalReport the number of articles existing in the wiki. Solution1. Add the following lines to config.php:
You can change the tag if you wish. I initially used to correspond with the markup variables like {$Group} and {$Title}, but figured (:numberofarticles:) is more in harmony with the average user's expectation for this type of markup. Notes
It will only count subdirectories.
~LiGuang
RequestCould this recipe be modified so that
So that See also
CommentsI've marked the recipe as obsolete, as its functionality can now be implemented using a pagelist, as follows. —Eemeli Aro July 29, 2009, at 01:04 PM
THX for your comment. One additional hint from my side, all articles in Site.* are not counted because of if (substr($file,0,1) != '.' && strpos($file, 'Site.') === false)
Any ideas to prevent this kind of behavior? Holger, July 21th, 2006 Articles in Site.* are not counted by design because why should already existing functionality count as content-style articles? That's a good idea for the category counting. I'll look into it. I needed to count the Number of Articles only the group seen by the public, so I reversed the logic of the selection line so that it only included those pages within the desired group: if (substr($file,0,1) != '.' && strpos($file, 'WantedGroup.') !== false){
so it only counts pages within the WantedGroup. Des July 23, 2007, at 09:05 AM The original line that determines the article count includes all pages, unlike Search or PageList which can ignore core pages. By modifying the count to simply deduct the number of core pages, the count accuracy can be maintained. In my case the RecentPages and Sandbox pages increased the count by 2, so reducing final the count by 2: $NumArticles = (count($list) - 2); gave the correct Number of Articles. Des July 23, 2007, at 09:05 AM Releases0.3 - September 18th, 2006 - fixed a problem with calling the function in PmWiki 2.1+
- thanks to John 0.2 - October 10th, 2005 - wrapped the code in a function
- shoutout to Gregor for the heads up 0.1 - September 24th, 2005 ContributorsUser notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |