Template:Ifdef

From ErfWiki

Jump to: navigation, search
Documentation is at Template:Ifdef/doc. edit

[edit] Usage

{{ifdef|value|result}} yields result  if value  isn't blank.

This template is used to simplify the following equivalent but somewhat cryptic code variants:

{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}

[edit] Example

Code Result
1 {{ifdef| |empty}} 1
2 {{ifdef|x|gotcha}} 2 gotcha
3 {{ifdef| {{{1| }}} | {{{1| }}} undefined}} 3
4 {{ifdef| {{{1|x}}} | {{{1|x}}} for an u}} 4 x for an u
5 {{ifdef| {{{ 1 }}} | {{{1}}} bad idea}} 5 {{{1}}} bad idea

For more info see: meta.wikimedia.org Ifdef

Go To:
Personal tools