Difference between revisions of "DPL Example 003"

From FollowTheScore
Jump to: navigation, search
(New page: {{subst:Example 002}})
 
Line 1: Line 1:
{{subst:Example 002}}
+
{{Example|Create a sortable table of articles based on template parameters, apply individual formatting to columns}}
 +
 
 +
We define "Country" as the column header for the first Column and make the table sortable.
 +
 
 +
<pre><nowiki>
 +
<dpl>
 +
  category=African Union member states
 +
  nottitlematch=Sudan
 +
  addpagecounter=true
 +
  includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
 +
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
 +
  table      =,Country,Area,Population,Text,#hits
 +
  tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
 +
</dpl>
 +
 
 +
</nowiki></pre>
 +
 
 +
----
 +
The above DPL command produces the following output:
 +
----
 +
 
 +
<dpl>
 +
  category=African Union member states
 +
  nottitlematch=Sudan
 +
  addpagecounter=true
 +
  includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
 +
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
 +
  table      =,Country,Area,Population,Text,#hits
 +
  tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
 +
</dpl>

Revision as of 23:40, 7 March 2009

back to list of examples

Create a sortable table of articles based on template parameters, apply individual formatting to columns

We define "Country" as the column header for the first Column and make the table sortable.

<dpl>
  category=African Union member states
  nottitlematch=Sudan
  addpagecounter=true
  includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
  table       =,Country,Area,Population,Text,#hits
  tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
</dpl>


The above DPL command produces the following output:


Country Area Population Text #hits
Cameroon 475,442 16,323,000
     ..→</small>
Nigeria 923,768 133,530,0001 Template:Let me test this

<table class="infobox geography vcard" style="width:46ex; ..→

Somalia 637,657 8,228,000
     ..→</small>