टेम्पलेट:Show data: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
→‎Parameters: the single parameter selection template Template:Pst2 is sufficient
On the page of the data template of a province, if there is no data template yet for the country, a link appears to create that, preloading this template. Otherwise the wikitext can be copied to the n
लाइन 112:
*[[Template:Popareadens]] - for use on the page [[List of countries by population]]
 
A parameter being undefined or empty typically means the same. Something like "popinc=" from the preload can be left in the wikitext to be filled in later, while for parameters which are not applicable, such as ''country'' for a country, the parameter definition "country=" can besee deletedbelow. <code><nowiki>{{data ..|get ..}}</nowiki></code> gives the empty string and the text "<code><nowiki>{{{..}}}</nowiki></code>", respectively. Therefore an application checking the parameter has to check both. Checking whether a result is equal to e.g. the text "<code>{{{popinc}}}</code>" cannot be done directly with #ifeq in a template which itself has also a parameter with that name, because if that is defined, there would be a comparison with the value instead of the text itself. Instead, it can be checked whether the first character of the result is "<code>{</code>", e.g.: <code><nowiki>{{#ifeq:{{padleft:|1|{{data {{{continent}}}|get popinc}}}}|{|..|..}}</nowiki></code>.
 
==Creating new data templates==
[[Template:Data/preload]] can be used to create new data templates. On the page of the data template of a province, if there is no data template yet for the country, a link appears to create that, preloading this template. Otherwise the wikitext can be copied to the new data template. For parameters which are not applicable, such as ''country'' for a country, the parameter definition "country=" can be deleted. For parameters to be filled in later the parameter definition like "popinc=" (specifying the empty string as value) can be left in the wikitext to be filled in later.
[[Template:Data/preload]] can be used to create new data templates.
 
{{refs}}
<includeonly>[[Category:Data templates|{{if||{{{country|}}}|{{{country}}} {{{1}}}|{{if|eq|{{{type}}}|continent| |{{if|eq|{{{1}}}|world| |{{{1}}}}}}}}}]]</includeonly><noinclude>[[Category:Data retrieval templates]]</noinclude>