Difference between revisions of "Template:Firstdata"
Jump to navigation
Jump to search
imported>DePiep |
imported>DePiep (→top) |
||
| Line 1: | Line 1: | ||
| − | {{trim|1={{#if:{{{1|}}}{{{2|}}}{{{3|}}} |{{#if:{{{1|}}}|{{{1|}}} |{{#if:{{{2|}}}|{{{2|}}} |{{{3|}}}}}}}}}}}<!-- | + | {{trim|1={{#if:{{{1|}}}{{{2|}}}{{{3|}}} |{{{prefix|}}}{{#if:{{{1|}}}|{{{1|}}} |{{#if:{{{2|}}}|{{{2|}}} |{{{3|}}}}}}}}}{{{suffix|}}}}}<!-- |
--><noinclude>{{documentation}}</noinclude> | --><noinclude>{{documentation}}</noinclude> | ||
Revision as of 10:25, 13 December 2016
In template code, one can list multiple input parameters, and this template will return the first input value that is not blank.
Example:
- In article:
{{Infobox foo|name= |height=1200 m |location=Spain }} - In template code:
{{Firstdata |{{{name|}}} |{{{location|}}}| {{{height|}}} }} - returns
Spainfor further processing
Usage
Can have up to five parameters input. Will return the first parameter that is not blank.
{{firstdata
|1=
|2=
|3=
|4=
|5=
}}
or
{{firstdata|||}}
Practical use is inside an other template:
{{firstdata|{{{foo|}}} |{{{bar|}}} }}
Whitespace is stripped.
Example
- {{firstdata||two|three}} → two
- {{firstdata|one||three}} → one
- {{firstdata|||}} →
See also
- {{If empty}}
| The above documentation is transcluded from Template:Firstdata/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |