Template:IfwpEdit This Page
From FamilySearch Wiki
This template allows branching without mw:Extension:ParserFunctions.
It uses the code {{{3{{{1}}}{{{1{{{1}}}{{{2}}}}}}}}}
Cases:
 If {{{1}}} is defined and not empty, this reduces to
{{{2}}}
 If {{{1}}} is defined and empty, this reduces to
{{{3}}}
 If {{{1}}} is undefined, this reduces to
{{{3{{{2}}}}}}
If the intention is to treat empty and undefined as equivalent, then:
If {{{1}}} is defined, we successfully avoid different results for {{{2}}} undefined or empty, and for {{{3}}} undefined or empty.
If {{{1}}} is undefined and {{{3}}} is defined, we successfully avoid different results for {{{2}}} undefined or empty.
If {{{1}}} and {{{3}}} are undefined, we successfully avoid different results for {{{2}}} undefined or empty.
If {{{1}}} is undefined and {{{2}}} is defined, we have {{{2}}} for {{{3}}} undefined, but empty for {{{3}}} empty. This is different if {{{2}}} is defined and not empty!
If {{{1}}} and {{{2}}} are undefined, we successfully avoid different results for {{{3}}} undefined or empty.
If {{{2}}} is defined and not empty and {{{3}}} is undefined, we get {{{2}}} if {{{1}}} is undefined, but empty if {{{1}}} is empty!
Summarizing: there is one deviating result: if {{{2}}} is defined and not empty, we get this value if {{{1}}} and {{{3}}} are both undefined, but not if one of both are empty.
With ParserFunctions we can use {{#if:{{{1}}}{{{2}}}{{{3}}}}}
.
Examples
Code  Result 
{{ifwpxyz}}

y 
{{ifwpyz}}

z 
{{ifwpxz}}


{{ifwpxy}}

y 
{{ifwpx}}


{{ifwpy}}


{{ifwpz}}

z 
{{ifwp}}


{{ifwp2=y3=z}}

z 
{{ifwp1=x3=z}}


{{ifwpxy}}

y 
{{ifwp2=3=z}}

z 
{{ifwp1=3=z}}

z 
{{ifwpy}}


{{ifwp2=y3=}}


{{ifwp1=x3=}}


{{ifwpx}}


{{ifwp2=3=}}


{{ifwp1=3=}}


{{ifwp}}


{{ifwpx}}


{{ifwp2=y}}

y 
{{ifwp3=z}}

z 
{{ifwp}}


{{ifwp2=}}


{{ifwp3=}}


{{ifwp}}

See also
The above documentation is transcluded from Template:Ifwp/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. 
 This page was last modified on 28 April 2012, at 09:50.
 This page has been accessed 282 times.
Future Changes to the Wiki
Changes are coming to the FamilySearch Research Wiki in the near future. Find out more on the Wiki Community News page.
Community News