Difference between revisions of "DPL Example 023"
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
DPL goes through all pages and initially builds an alphabetically sorted list of matching articles. | 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]]. | ||
<pre><nowiki> | <pre><nowiki> | ||
Line 11: | Line 15: | ||
|category=Fictitious country | |category=Fictitious country | ||
|include={Country}.listByCapital | |include={Country}.listByCapital | ||
− | |table=class=sortable | + | |table=class="wikitable sortable",-,Capital,Country,Official Name |
}} | }} | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
Line 23: | Line 26: | ||
|category=Fictitious country | |category=Fictitious country | ||
|include={Country}.listByCapital | |include={Country}.listByCapital | ||
− | |table=class=sortable | + | |table=class="wikitable sortable",-,Capital,Country,Official Name |
}} | }} | ||
− |
Latest revision as of 20:48, 22 August 2012
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 |