Template:if defined call
From Bohemia Interactive Community
Syntax
{{if defined call|VALUE|TEMPLATE|PARAM1*|PARAM2*|PARAM3*}}
This template calls a template only if the given value exists. The value is given in the first argument, the template name in the second. The other arguments are optional paramters that will be passed to the template in case that VALUE is defined. You may define none, one, two or all parameters here.
Examples
{{if defined call|defined_value|my_template|first_argument}}
This example would check whether the first paramter (in this case 'defined_value') exists. In this case the parameter is defined and the template 'my_template' will be included with parameter 1 being 'first_argument'.
{{if defined call||my_template|first_argument|second_argument}}
In this case, the first parameter is null, so nothing would happen.
Usage
This template is very useful to verify in other templates whether a parameter was given or not. If the parameter was given, you can include another template using the parameter. Else this template will return an empty string "".
{{if defined call|{{{1|}}}|only_call_if_param_exists_template|{{{1}}}}}
Important: If you check whether paramters exist, you have to include the alternative NULL (the | with no text after) in the parameter!!
In this case, the template 'only_call_if_param_exists_template' will only be called if parameter {{{1}}} is defined and will receive this parameter as first argument.

