Iflabel: Difference between revisions
From Beyond the Pale
added explanation Tag: Reverted |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{#if: {{{1}}}|'''{{{2}}}'''|}} | {{#if: {{{1}}}|'''{{{2}}}'''|}}<noinclude><hr>Used to quickly produce a bolded label for an optional parameter in a template. <p><br> | ||
<noinclude><hr>Used to quickly produce a bolded label for an optional parameter in a template. <p><br> | |||
<code><nowiki>{{#if: {{{1}}}|'''{{{2}}}'''|}}</nowiki></code> | <code><nowiki>{{#if: {{{1}}}|'''{{{2}}}'''|}}</nowiki></code> | ||
where 1 is the parameter to check (e.g. <nowiki>{{{mentor|}}}</nowiki> and 2 is the text of the label (e.g. Mentor). | where 1 is the parameter to check (e.g. <nowiki>{{{mentor|}}}</nowiki> and 2 is the text of the label (e.g. Mentor). | ||
<p><br> | <p><br> | ||
Therefore, <code><nowiki>{{iflabel|{{{mentor|}}}|Mentor}}</nowiki></code> would produce '''Mentor''' if <nowiki>{{{mentor|}}}</nowiki> is provided with a value, and remain blank if <nowiki>{{{mentor|}}}</nowiki> is undefined. | Therefore, <code><nowiki>{{iflabel|{{{mentor|}}}|Mentor}}</nowiki></code> would produce '''Mentor''' if <nowiki>{{{mentor|}}}</nowiki> is provided with a value, and remain blank if <nowiki>{{{mentor|}}}</nowiki> is undefined. | ||
<br> | <br></noinclude> | ||
</noinclude> | |||
Latest revision as of 04:11, 2 January 2026
{{{2}}}
Used to quickly produce a bolded label for an optional parameter in a template.
{{#if: {{{1}}}|'''{{{2}}}'''|}}
where 1 is the parameter to check (e.g. {{{mentor|}}} and 2 is the text of the label (e.g. Mentor).
Therefore, {{iflabel|{{{mentor|}}}|Mentor}} would produce Mentor if {{{mentor|}}} is provided with a value, and remain blank if {{{mentor|}}} is undefined.