Difference between revisions of "Template:Data country"

From Hitchwiki
Jump to navigation Jump to search
 
Line 1: Line 1:
<noinclude>This is a data template which takes name of the country and returns 2 commonly used currencies (codes), capital, subregion and population. Separated by slashes.
+
<noinclude>This is a data template which takes name of the country and returns 2 commonly used currencies (codes), capital, subregion and population. Separated by slashes. Second optional parameter is for choosing which value should template return.
  
 
'''Examples:'''  
 
'''Examples:'''  
Line 6: Line 6:
 
{{Data country|Cuba}} -> CUC/CUP/Havana/Caribbean/11167325
 
{{Data country|Cuba}} -> CUC/CUP/Havana/Caribbean/11167325
  
{{#titleparts: {{Data country|Afghanistan}} | 1 }} -> AFN
+
{{Data country|Afghanistan|cur}} -> AFN
{{#titleparts: {{Data country|Afghanistan}} | 1 | 2 }} ->
+
{{Data country|Afghanistan|cur1}} -> AFN
{{#titleparts: {{Data country|Afghanistan}} | 1 | 3 }} -> Kabul
+
{{Data country|Afghanistan|currency}} -> AFN
{{#titleparts: {{Data country|Afghanistan}} | 1 | 4 }} -> Southern Asia
+
{{Data country|Afghanistan|currency1}} -> AFN
{{#titleparts: {{Data country|Afghanistan}} | 1 | 5 }} -> 26023100
+
{{Data country|Afghanistan|cur2}} ->
 +
{{Data country|Afghanistan|currency2}} ->
 +
{{Data country|Afghanistan|cap}} -> Kabul
 +
{{Data country|Afghanistan|capital}} -> Kabul
 +
{{Data country|Afghanistan|sub}} -> Southern Asia
 +
{{Data country|Afghanistan|subregion}} -> Southern Asia
 +
{{Data country|Afghanistan|pop}} -> 26023100
 +
{{Data country|Afghanistan|population}} -> 26023100
 
</pre>
 
</pre>
  
 
[[Category:Templates]]
 
[[Category:Templates]]
</noinclude><includeonly>{{#switch:{{{1}}}
+
</noinclude><includeonly>{{#titleparts: {{#switch:{{{1}}}
 
|Abkhazia=RUB//Sukhumi/Western Asia/240705
 
|Abkhazia=RUB//Sukhumi/Western Asia/240705
 
|Afghanistan=AFN//Kabul/Southern Asia/26023100
 
|Afghanistan=AFN//Kabul/Southern Asia/26023100
Line 272: Line 279:
 
|Zambia=ZMK//Lusaka/Eastern Africa/15023315
 
|Zambia=ZMK//Lusaka/Eastern Africa/15023315
 
|Zimbabwe=ZWL//Harare/Eastern Africa/13061239
 
|Zimbabwe=ZWL//Harare/Eastern Africa/13061239
|}}<nowiki /></includeonly>
+
|}}
 +
| {{#if:{{{2|}}}|1}}
 +
| {{#switch:{{{2}}}
 +
|cur
 +
|cur1
 +
|currency
 +
|currency1=1
 +
|cur2
 +
|currency2=2
 +
|cap
 +
|capital=3
 +
|sub
 +
|subregion=4
 +
|pop
 +
|population=5 }} }}<nowiki /></includeonly>

Latest revision as of 02:04, 25 September 2014

This is a data template which takes name of the country and returns 2 commonly used currencies (codes), capital, subregion and population. Separated by slashes. Second optional parameter is for choosing which value should template return.

Examples:

{{Data country|Afghanistan}} -> AFN//Kabul/Southern Asia/26023100
{{Data country|Cuba}} -> CUC/CUP/Havana/Caribbean/11167325

{{Data country|Afghanistan|cur}} -> AFN
{{Data country|Afghanistan|cur1}} -> AFN
{{Data country|Afghanistan|currency}} -> AFN
{{Data country|Afghanistan|currency1}} -> AFN
{{Data country|Afghanistan|cur2}} ->
{{Data country|Afghanistan|currency2}} ->
{{Data country|Afghanistan|cap}} -> Kabul
{{Data country|Afghanistan|capital}} -> Kabul
{{Data country|Afghanistan|sub}} -> Southern Asia
{{Data country|Afghanistan|subregion}} -> Southern Asia
{{Data country|Afghanistan|pop}} -> 26023100
{{Data country|Afghanistan|population}} -> 26023100