<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://xdandroid.com/w/index.php?action=history&amp;feed=atom&amp;title=Help%3AParser_functions_in_templates</id>
	<title>Help:Parser functions in templates - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://xdandroid.com/w/index.php?action=history&amp;feed=atom&amp;title=Help%3AParser_functions_in_templates"/>
	<link rel="alternate" type="text/html" href="http://xdandroid.com/w/index.php?title=Help:Parser_functions_in_templates&amp;action=history"/>
	<updated>2026-05-13T14:49:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://xdandroid.com/w/index.php?title=Help:Parser_functions_in_templates&amp;diff=441&amp;oldid=prev</id>
		<title>XdandroidBot: Mirror from http://www.mediawiki.org/wiki/Help:Parser functions in templates</title>
		<link rel="alternate" type="text/html" href="http://xdandroid.com/w/index.php?title=Help:Parser_functions_in_templates&amp;diff=441&amp;oldid=prev"/>
		<updated>2010-06-23T00:37:27Z</updated>

		<summary type="html">&lt;p&gt;Mirror from http://www.mediawiki.org/wiki/Help:Parser functions in templates&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;When applying [[Help:Extension:ParserFunctions|ParserFunctions]] to [[Help:Template|template]] parameters, a pipe symbol (&amp;quot;|&amp;quot;) may be used to provide the empty string as default value, in order to indicate how to handle things if a parameter is or is not passed in.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{{1}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:;Sample A: &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{#if: {{{1}}} | Parameter 1 is not defined, or is defined and non-null/non-empty. | Parameter 1 is null. It contains only empty string(s) or breaking space(s) etc.}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:;Result: &amp;lt;tt&amp;gt;{{#if: {{{1}}} | Parameter 1 is not defined, or is defined and non-null/non-empty. | Parameter 1 is null. It contains only empty string(s) or breaking space(s) etc.}}&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{{1|}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:;Sample B: &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{#if: {{{1|}}} | Parameter 1 is defined and non-null/non-empty. | Parameter 1 is not defined, or is defined but null. It contains only empty string(s) or breaking space(s) etc.}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:;Result: &amp;lt;tt&amp;gt;{{#if: {{{1|}}} | Parameter 1 is defined and non-null/non-empty. | Parameter 1 is not defined, or is defined but null. It contains only empty string(s) or breaking space(s) etc.}}&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Comparison&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Condition of parameter 1&lt;br /&gt;
! Sample A: &amp;lt;nowiki&amp;gt;{{{1}}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
! Sample B: &amp;lt;nowiki&amp;gt;{{{1|}}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|not defined||&amp;#039;&amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039;&amp;#039;||&amp;#039;&amp;#039;FALSE&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defined but null/empty||&amp;#039;&amp;#039;FALSE&amp;#039;&amp;#039;||&amp;#039;&amp;#039;FALSE&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defined and NOT null/empty||&amp;#039;&amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039;&amp;#039;||&amp;#039;&amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The second usage (&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{{1|}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;) is often the desired way to handle situations where a parameter exists, but is comprised only of empty space.&lt;br /&gt;
&lt;br /&gt;
One way to test whether a parameter was specified in a template call is thus:&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{#ifeq:{{{v|}}}|{{{v|-}}}| v was specified (and may be empty) | v was not specified }}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In rare cases, a template behaves differently when a parameter is unspecified compared to when it is specified but empty. When this template is used by a wrapper template (which uses the same set of named parameters), one way to ensure undefined parameters remain undefined is as follows (the technique also works with numbered parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!-- wrapper template code --&amp;gt;&lt;br /&gt;
{{wrapped_template|&lt;br /&gt;
normal_parameter={{{normal_parameter|}}}|&lt;br /&gt;
sensitive_parameter{{#ifeq:{{{sensitive_parameter|}}}|{{{sensitive_parameter|-}}}||x}}={{{sensitive_parameter|}}}|&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;lt;tt&amp;gt;wrapped_template&amp;lt;/tt&amp;gt; receives a specified but empty &amp;lt;tt&amp;gt;normal_parameter&amp;lt;/tt&amp;gt; in two cases: when &amp;lt;tt&amp;gt;normal_parameter&amp;lt;/tt&amp;gt; is specified and empty, and when &amp;lt;tt&amp;gt;normal_parameter&amp;lt;/tt&amp;gt; is unspecified (because the default empty value is then specified by the wrapper template).&lt;br /&gt;
&lt;br /&gt;
By contrast, the &amp;lt;tt&amp;gt;wrapped_template&amp;lt;/tt&amp;gt; receives a specified &amp;lt;tt&amp;gt;sensitive_parameter&amp;lt;/tt&amp;gt; &amp;#039;&amp;#039;only&amp;#039;&amp;#039; when it is indeed specified, because the &amp;lt;tt&amp;gt;#ifeq&amp;lt;/tt&amp;gt; changes the &amp;lt;tt&amp;gt;wrapped_template&amp;lt;/tt&amp;gt; parameter name to « &amp;lt;tt&amp;gt;sensitive_parameterx&amp;lt;/tt&amp;gt; » when &amp;lt;tt&amp;gt;sensitive_parameter&amp;lt;/tt&amp;gt; is undefined. Note also that &amp;lt;tt&amp;gt;wrapped_template&amp;lt;/tt&amp;gt; receives a specified and empty &amp;lt;tt&amp;gt;sensitive_parameter&amp;lt;/tt&amp;gt; &amp;#039;&amp;#039;only&amp;#039;&amp;#039; when the wrapper template receives a specified and empty &amp;lt;tt&amp;gt;sensitive_parameter&amp;lt;/tt&amp;gt;. Of course, one must make sure the suffixed &amp;lt;tt&amp;gt;wrapped_template&amp;lt;/tt&amp;gt; parameter name is meaningless to the &amp;lt;tt&amp;gt;wrapped_template&amp;lt;/tt&amp;gt; for this to work properly.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Help:Extension:ParserFunctions]]&lt;br /&gt;
*[[Help:Template]]&lt;br /&gt;
&lt;br /&gt;
{{Languages}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Help|Parser functions in templates]]&lt;br /&gt;
[[Category:Imported help]]&lt;/div&gt;</summary>
		<author><name>XdandroidBot</name></author>
		
	</entry>
</feed>