Difference between revisions of "DPL Example 023"

From FollowTheScore
Jump to: navigation, search
(New page: {{Example|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 alphabet...)
 
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.
We output the columns in different order (just for convenience) and thgen we use a small piece of javascript code to resort the table by column one.
+
We output the columns in different order (just for convenience) and then we use a small piece of javascript code to resort the table by column one.
 +
As we must insert the link to the article at column position two, we need an phantom template [[Template:Country.listByCapital]] to format the output of each line.
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 20: Line 21:
 
{{#dpl:
 
{{#dpl:
 
  |category=Fictitious country
 
  |category=Fictitious country
  |include={Country}:capital:name
+
  |include={Country}.listByCapital
  |table=class=sortable wikitable,-,Capital,[[%PAGE%|%TITLE%]],Official Name
+
  |table=class=sortable wikitable,-,Capital,Country,Official Name
 
}}
 
}}

Revision as of 08:01, 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. We output the columns in different order (just for convenience) and then we use a small piece of javascript code to resort the table by column one. As we must insert the link to the article at column position two, we need an phantom template Template:Country.listByCapital to format the output of each line.

{{#dpl:
 |category=Fictitious country
 |include={Country}:capital:name
 |table=,,Capital,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