DynamicPageList2 is an extension with plenty of potential for wikis which make good use of categories.
http://meta.wikimedia.org/wiki/DynamicPageList2
Can anybody help to find a way to produce counts and totals as well as or instead of lists please?
EG: Total number of pages with both category "this" and category "that" = 492
On 9/13/06, Andy Roberts aroberts@gmail.com wrote:
DynamicPageList2 is an extension with plenty of potential for wikis which make good use of categories.
http://meta.wikimedia.org/wiki/DynamicPageList2
Can anybody help to find a way to produce counts and totals as well as or instead of lists please?
EG: Total number of pages with both category "this" and category "that" = 492
-- Andy Roberts
http://distributedresearch.net/blog/ _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Hello, this feature has already been requested (more or less): http://meta.wikimedia.org/wiki/Talk:DynamicPageList2#mode.3Dcount If you want to add something and get some help, this is the place to go.
I am still working on other features that have been requested a long time ago (but when a patch is submitted with a request, I try to make it a priority).
Meanwhile, I can give you some help if you want to look at the code. To get counts, I can see at least 2 ways. The changes mentioned here concern DynamicPageList2 v0.6.4: 1) (Depending on DPL2 parameters to be specified, like 'mode=count') change the SQL query line 592 and use something like SELECT count(page_title) blabla instead. This would keep the SQL to a minimum, good for performance. Then get the counts with "$dbr->numRows( $res )" like at l. 682. 2) Quick easy solution: just use the "$dbr->numRows( $res )" like at l. 682, no matter what the query was. ( If you don't want to mess with it.)
Last, be careful with the ordermethod you are using. With multi-param ordermethod, you may get the same page more than once. For instance, with 'ordermethod=category,title', if a page on your wiki links to 10 categories, you'll have 10 occurrences of the page in the result. You may not want to count them as much. This is not the case for simple ordermethods (firstedit, lastedit, title...)
This is just a hint, hope it helps. If you think of something else... Use the talk page (see link above).
-- Cyril Dangerville
mediawiki-l@lists.wikimedia.org