Wiki League of Legends
Advertisement

If data template Data {{{1}}} exists and has the parameter {{{2}}} defined, return {{{3}}}; otherwise, return {{{4}}} (if provided).

Note
Because this template retrieves data directly from data templates, using this within data retrieval templates should be done with care. Ensure that this template will never be exposed if the parent template a data template parameter (that is, {{Data template|Parent template}}). For example, Template:Ifdataparadef/demo1 contains an exposed call to Template:ifdataparadef with 2 possible uses for data retrieval.
  • "{{Ifdataparadef/demo1|Ahri|title=Sample}}" gives "{{{1}}}=Ahri, {{{title}}}=Sample, {{{title|{{ifdataparadef|{{{1}}}|title|null}}}}}=Sample, {{ifdataparadef|{{{1}}}|title|null}}=null"
  • "{{Data Ahri|Ifdataparadef/demo1}}" gives "{{{1}}}=Ahri, {{{title}}}=la Vastaya de Nueve Colas, {{{title|{{ifdataparadef|{{{1}}}|title|null}}}}}=la Vastaya de Nueve Colas, {{ifdataparadef|{{{1}}}|title|null}}=null"

Example

Code Result
"{{ifdataparadef|{{{1}}}|popinc|yes|no}}" "no"
"{{ifdataparadef|Lee Sin|popinc|yes|no}}" "no"
"{{ifdataparadef|Lee Sin|title|yes|no}}" "yes"
"{{ifdataparadef|Urf|title|yes|no}}" "yes"

Truth tables

1 A B C1 C2
{{{1}}} 0 1 0 0
0 1 1 1
Ahri 1 1 1 0
Urf 1 1 1 1
  • A = {{#if:{{{1|}}}|1|0}}
  • B = {{#ifeq:[[:Template:Data {{{1}}}]]|{{Data {{{1}}}|1x}}|0|1}}
  • C1 = {{#ifeq:{{padleft:|1|{{Data {{{1}}}|pst2|title}}}}|{|0|1}}
  • C2 = {{#ifeq:{{padleft:|1|{{Data {{{1}}}|pst2|foobar}}}}|{|0|1}}
Advertisement