Difference between revisions of "Test numberOfArticles"

From FollowTheScore
Jump to: navigation, search
Line 24: Line 24:
 
* {{DPL Count|category=Fictitious Country}}
 
* {{DPL Count|category=Fictitious Country}}
 
* {{DPL Count|category=Fictitious country}}
 
* {{DPL Count|category=Fictitious country}}
 +
 +
==Another way to show multiple article counts==
 +
This time we use the headingmode and headingcount parameters. Note that we get a message for each category.
 +
<pre><nowiki>
 +
<dpl>
 +
  ordermethod=category,lastedit
 +
  category=+Fictitious country|Countries|Cities|Villages
 +
  headingmode=H4
 +
  headingcount=true
 +
  mode=userformat
 +
</dpl>
 +
</nowiki></pre>
 +
 +
<dpl>
 +
  ordermethod=category,lastedit
 +
  category=+Fictitious country|Countries|Cities
 +
  headingmode=H4
 +
  headingcount=true
 +
  mode=userformat
 +
</dpl>

Revision as of 19:16, 21 April 2007

Template:Type:Test

Show the number of articles in a certain category

This test shows how to put a DPL statement into a template (just for fun in this case) and how to return the number of articles instead of their names. We are going to use the 'resultsheader=' parameter which allows you to use a variable called %PAGES%.

We are going to use a template which contains the following code
  {{#dpl:
    |category        = {{{category}}}
    |mode            = userformat
    |resultsheader   = There are %PAGES% articles on ''{{{category}}}'' in this wiki.
    |noresultsheader = This wiki doesn´t contain any articles on ''{{{category}}}''.
  }}

We are going to call the template like this:
   {{DPL Count|category=Fictitious Countries}}
  • This wiki doesn´t contain any articles on Fictitious Country.
  • There are 4 articles on Fictitious country in this wiki.

Another way to show multiple article counts

This time we use the headingmode and headingcount parameters. Note that we get a message for each category.

<dpl>
  ordermethod=category,lastedit
  category=+Fictitious country|Countries|Cities|Villages
  headingmode=H4
  headingcount=true
  mode=userformat
</dpl>

Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option 'H4' for parameter 'headingmode'.


Extension:DynamicPageList (DPL), version 3.2.1: Warning: No results.