Difference between revisions of "DPL Example 023"

From FollowTheScore
Jump to: navigation, search
Line 5: Line 5:
 
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.
 
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 by column one immediately before it is being displayed.
+
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 by column two.
+
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]].
 
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]].
Line 17: Line 17:
 
  |table=class=sortable wikitable,-,Capital,Country,Official Name
 
  |table=class=sortable wikitable,-,Capital,Country,Official Name
 
}}
 
}}
{{Sort Table By Column|1}}
+
{{Sort Table By Column|1|1}}
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 29: Line 29:
 
  |table=class=sortable wikitable,-,Capital,Country,Official Name
 
  |table=class=sortable wikitable,-,Capital,Country,Official Name
 
}}
 
}}
{{Sort Table By Column|1}}
+
{{Sort Table By Column|1|1}}

Revision as of 09:20, 20 June 2009

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=sortable wikitable,-,Capital,Country,Official Name
}}
{{Sort Table By Column|1|1}}

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

Template:Sort Table By Column