Difference between revisions of "DPL Example 003"

From FollowTheScore
Jump to: navigation, search
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Example|Create a sortable table of articles based on template parameters, apply individual formatting to columns}}
+
{{Example|Create a table of articles based on template parameters, apply individual formatting to columns, add meta data}}
  
We define "Country" as the column header for the first Column and make the table sortable.
+
We show various template parameters. We add meta data (in this case the ''hit count''). We format huge hit counts using a big font. We put a decimal point before the last three digits. Population is right justified and in small font. Populations with '133' occuring in the number get a red background color.
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 8: Line 8:
 
   nottitlematch=Sudan
 
   nottitlematch=Sudan
 
   addpagecounter=true
 
   addpagecounter=true
   includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
+
   includepage ={Infobox Country or territory}:area:population_estimate
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
+
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²'''</big>¦²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²}²,
   table      =,Country,Area,Population,Text,#hits
+
   table      =,Country,Area,Population,#hits
   tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
+
   tablerow    =align=right|%%,align=right ²{#if:²{#pos:%%¦133}²¦bgcolor=#ff9999¦bgcolor=#ffffaa}²|<small>%%</small>
 
</dpl>
 
</dpl>
 
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 24: Line 23:
 
   nottitlematch=Sudan
 
   nottitlematch=Sudan
 
   addpagecounter=true
 
   addpagecounter=true
   includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
+
   includepage ={Infobox Country or territory}:area:population_estimate
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
+
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²'''</big>¦²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²}²,
   table      =,Country,Area,Population,Text,#hits
+
   table      =,Country,Area,Population,#hits
   tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
+
   tablerow    =align=right|%%,align=right ²{#if:²{#pos:%%¦133}²¦bgcolor=#ff9999¦bgcolor=#ffffaa}²|<small>%%</small>
 
</dpl>
 
</dpl>

Latest revision as of 23:50, 5 June 2009

back to list of examples

Create a table of articles based on template parameters, apply individual formatting to columns, add meta data

We show various template parameters. We add meta data (in this case the hit count). We format huge hit counts using a big font. We put a decimal point before the last three digits. Population is right justified and in small font. Populations with '133' occuring in the number get a red background color.

<dpl>
  category=African Union member states
  nottitlematch=Sudan
  addpagecounter=true
  includepage ={Infobox Country or territory}:area:population_estimate
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²'''</big>¦²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²}²,
  table       =,Country,Area,Population,#hits
  tablerow    =align=right|%%,align=right ²{#if:²{#pos:%%¦133}²¦bgcolor=#ff9999¦bgcolor=#ffffaa}²|<small>%%</small>
</dpl>

The above DPL command produces the following output:


Country Area Population #hits
Cameroon 475,442 16,323,000
Nigeria 923,768 133,530,0001
Somalia 637,657 8,228,000