Forum:Number of pages in a category

Is there any way to display te number of a page? Let's say there are three tags,  ,    and   . Let's say I use them like this: Now I ask, is there any such tag? Or could it be done via   ? Thanks for answering. – Smiddle 15:22, 26 April 2007 (UTC)
 *   = 17
 *   = 16
 *   = 1


 * outputs total articles, outputs number of pages  is supposed to return the number of pages in a Namespace, but it's disabled by default. So there is no, real tag to efficiently do that, and there is no parameter in DPL to actually do that. But there is an arbitrary way to do that combining DPL with ParserFunctions.

Using this code dpl would output a 1 for each title, and a + would be placed after each of them as a separator, the 0 is there because a + is also added after the very last one, that 0 is placed at the very end to cancel out that last +. So this code would output 1+1+1+1+0 if the category it listed had 4 categories. (Because namespace is set to category and category is set to a category name:  debug         = 0 mode           = userformat listseparators = ,1,+,0 namespace      = Category category       = Something </DPL>
 * Note that the debug=0 forces DPL to not display the message saying it can't find anything, because it would cause a glitch in the further code.

Now, the thought is, how do we use that? Parserfunction's #expr would work for that. But because hooks won't work right, we'll half to use the DPL parserfunction, here's the full code:
 * If there are 4 categories under that category then dpl will output 1+1+1+1+0. And the 0 in the expr will turn it into 01+1+1+1+0 (The leading and ending 0's are of course ignored mathematically). If you're wondering what the 0 is there for, when you have no results and debug is set to 0 then DPL will output nothing, that 0 in expr makes it output a 0 instead of nothing.
 * It's not the prettiest code, but it does work. Though I would note to you, that this code won't work until the DPL extension on Wikia is upgraded.
 * Potentially you could also create a Template:CATEGORIESINCAT and use this as the code:


 * Then using would output the number of categories in the Help category. And of course it could be extended into other templates. ~Dantman(talk) tricks  Apr 26, 2007 @ 21:24 (UTC)