Difference between revisions of "Template:Ifwp"

From HeRO Wiki
Jump to: navigation, search
(Finally found the template I was looking for)
 
(Added usage instructions.)
Line 1: Line 1:
{{{3{{{1|}}}|{{{1{{{1|}}}|{{{2|}}}}}}}}}<noinclude>
+
<includeonly>{{{3{{{1|}}}|{{{1{{{1|}}}|{{{2|}}}}}}}}}</includeonly><noinclude>
 +
 
 +
This template's code is:
 +
<pre>
 +
{{{3{{{1|}}}|{{{1{{{1|}}}|{{{2|}}}}}}}}}
 +
</pre>
 +
 
 +
== Usage ==
 +
* If parameter 1 is defined and not empty, parameter 2 will be returned.
 +
* If parameter 1 is defined and empty, parameter 3 will be returned.
 +
* If parameter 1 is not defined at all, <nowiki>{{{1}}}</nowiki> will be returned.
 +
 
 +
This template is best used in other templates that can specify the default parameters in their usage documentation, such that parameter 1 is always defined, even if it's empty.
  
 
See [https://meta.wikimedia.org/wiki/Template:Ifwp Template:Ifwp on meta.wikimedia.org]
 
See [https://meta.wikimedia.org/wiki/Template:Ifwp Template:Ifwp on meta.wikimedia.org]
 +
 +
[[Category:Utility templates]]
 
</noinclude>
 
</noinclude>

Revision as of 02:59, 12 November 2022


This template's code is:

{{{3{{{1|}}}|{{{1{{{1|}}}|{{{2|}}}}}}}}}

Usage

  • If parameter 1 is defined and not empty, parameter 2 will be returned.
  • If parameter 1 is defined and empty, parameter 3 will be returned.
  • If parameter 1 is not defined at all, {{{1}}} will be returned.

This template is best used in other templates that can specify the default parameters in their usage documentation, such that parameter 1 is always defined, even if it's empty.

See Template:Ifwp on meta.wikimedia.org