DPL Example 023
back to list of examples
Create a SORTED table of articles based on template parameters
This is basically the same as DPL Example 001.
DPL goes through all pages and initially builds an alphabetically sorted list of matching articles. For convenience we output the columns in different sequence. Therefore we need an phantom template Template:Country.listByCapital to format the output of each line. Finally we call a template to resort the table #1 by column #1 immediately before it is being displayed.
Had we kept the standard column arrangement from Example 001 we could have done without the phantom template. In this case we would have had to sort table #1 by column #2.
If you copy this code to your wiki and you see the sort arrows in the column headings appear twice you must apply a small patch to the mediawiki sorting script. For details see DPL:Manual - DPL parameters: Controlling output order.
{{#dpl: |category=Fictitious country |include={Country}.listByCapital |table=class="wikitable sortable",-,Capital,Country,Official Name }}
The above DPL command produces the following output:
Capital | Country | Official Name |
---|---|---|
DPL Example 007 main page 1 | ||
Bamitogoo | Nigunda | Republic of Nigunda |
Bamitogoo Test | Nigunda Test | Republic of Nigunda Test |
Aaaabququque | Somango | Somango Island |