I have an infobox like this
{{Infobox
|name = {{{name}}}
|status = {{{status}}}
|-
|! style="text-align:center; color:white; font-size:1.4em; line-height:1.3em; background:#827f75" colspan="2" {{!}}Contacts
|-
{{#if:{{{Person1|}}}|
{{!}} Person1
{{!}} {{{Person1}}}
|-
{{#if:{{{Person2|}}}|
{{!}} Person2
{{!}} {{{Person2}}}
}}
The issue I have is that the label "Contacts" will be visible even if there's no parameter set for "Person1" or "Person2". This is what i've attempted.
{{#if:{{{Person1}}} or {{{Person2}}}|
{{!}} style="text-align:center; color:white; font-size:1.4em; line-height:1.3em; background:#827f75" colspan="2" {{!}}Contacts
}}
This does however not work for some reason, it always prints out the label as if the statement is always true.
if
evaluates the true branch if the condition is not empty and vice versa. At the same time {{{parameter}}}
evaluates to the same string ("{{{parameter}}}") if this parameter wasn't supplied. In order for it to be evaluated to empty string, you need to provide an empty default value: {{{parameter|}}}
. Also, or
is neither needed nor helpful here, so the resulting expression should be:
{{#if:{{{Person1|}}}{{{Person2|}}}
or
{{#if:{{{Person1|{{{Person2|}}}}}}
For more information, see: