Difference between revisions of "Template:Firstdata/doc"

From blackwiki
Jump to navigation Jump to search
imported>DePiep
imported>DePiep
Line 2: Line 2:
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
 
In template code, one can list multiple input parameters, and this template will return the first input value that is not blank.
 
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: <nowiki>{{Infobox foo|name= |height=1200 m |location=Spain }}</nowiki>
 +
:In template code:
 +
:{{Firstdata| {{{name|}}} | {{{location|}}} | {{{height|}}}}}
 +
:returns <code>Spain</code> for further processing
  
 
== Usage ==
 
== Usage ==

Revision as of 14:09, 3 October 2019

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:
returns Spain for 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|||}} →