<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;feed=atom&amp;action=history</id>
		<title>Help:Parser functions in templates - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;action=history"/>
		<updated>2013-05-25T10:50:51Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.22alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;diff=15339&amp;oldid=prev</id>
		<title>Wmat: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;diff=15339&amp;oldid=prev"/>
				<updated>2009-12-03T04:33:08Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 04:33, 3 December 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Wmat</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;diff=15338&amp;oldid=prev</id>
		<title>Cherry2005: Difference between empty and unspecified, when it matters</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Help:Parser_functions_in_templates&amp;diff=15338&amp;oldid=prev"/>
				<updated>2009-08-27T17:40:50Z</updated>
		
		<summary type="html">&lt;p&gt;Difference between empty and unspecified, when it matters&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||'''TRUE'''||''FALSE''&lt;br /&gt;
|-&lt;br /&gt;
|defined but null/empty||''FALSE''||''FALSE''&lt;br /&gt;
|-&lt;br /&gt;
|defined and NOT null/empty||'''TRUE'''||'''TRUE'''&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; ''only'' 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; ''only'' 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;
[[Category:Help|Parser functions in templates]]&lt;/div&gt;</summary>
		<author><name>Cherry2005</name></author>	</entry>

	</feed>