<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki42.maceys.net/index.php?action=history&amp;feed=atom&amp;title=Help%3ATemplate</id>
	<title>Help:Template - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki42.maceys.net/index.php?action=history&amp;feed=atom&amp;title=Help%3ATemplate"/>
	<link rel="alternate" type="text/html" href="https://wiki42.maceys.net/index.php?title=Help:Template&amp;action=history"/>
	<updated>2026-04-14T07:50:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.3</generator>
	<entry>
		<id>https://wiki42.maceys.net/index.php?title=Help:Template&amp;diff=494&amp;oldid=prev</id>
		<title>Lynn: Created page with &quot;This page is about designing templates more than using them. For details of how to use existing templates, see Help:Editing or the documentation for any template.   == Including == To include a template---or any page---in another page:  * &lt;code&gt;{{lb}}T{{rb}}&lt;/code&gt; includes Template:T * &lt;code&gt;{{lb}}&lt;b&gt;:&lt;/b&gt;Page name{{rb}}&lt;/code&gt; includes Page name * &lt;code&gt;{{lb}}subst:T{{rb}}&lt;/code&gt; or &lt;code&gt;{{lb}}subst&lt;b&gt;::&lt;/b&gt;Page name{{rb}}&lt;/c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki42.maceys.net/index.php?title=Help:Template&amp;diff=494&amp;oldid=prev"/>
		<updated>2026-01-26T00:55:16Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page is about designing templates more than using them. For details of how to use existing templates, see &lt;a href=&quot;/index.php?title=Help:Editing&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Help:Editing (page does not exist)&quot;&gt;Help:Editing&lt;/a&gt; or the documentation for &lt;a href=&quot;/index.php?title=Special:AllPages/Template:&quot; title=&quot;Special:AllPages/Template:&quot;&gt;any template&lt;/a&gt;.   == Including == To include a template---or any page---in another page:  * &amp;lt;code&amp;gt;{{lb}}T{{rb}}&amp;lt;/code&amp;gt; includes &lt;a href=&quot;/index.php?title=Template:T&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Template:T (page does not exist)&quot;&gt;Template:T&lt;/a&gt; * &amp;lt;code&amp;gt;{{lb}}&amp;lt;b&amp;gt;:&amp;lt;/b&amp;gt;Page name{{rb}}&amp;lt;/code&amp;gt; includes &lt;a href=&quot;/index.php?title=Page_name&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Page name (page does not exist)&quot;&gt;Page name&lt;/a&gt; * &amp;lt;code&amp;gt;{{lb}}subst:T{{rb}}&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;{{lb}}subst&amp;lt;b&amp;gt;::&amp;lt;/b&amp;gt;Page name{{rb}}&amp;lt;/c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page is about designing templates more than using them. For details of how to use existing templates, see [[Help:Editing]] or the documentation for [[Special:AllPages/Template:|any template]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Including ==&lt;br /&gt;
To include a template---or any page---in another page:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;{{lb}}T{{rb}}&amp;lt;/code&amp;gt; includes [[Template:T]]&lt;br /&gt;
* &amp;lt;code&amp;gt;{{lb}}&amp;lt;b&amp;gt;:&amp;lt;/b&amp;gt;Page name{{rb}}&amp;lt;/code&amp;gt; includes [[Page name]]&lt;br /&gt;
* &amp;lt;code&amp;gt;{{lb}}subst:T{{rb}}&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;{{lb}}subst&amp;lt;b&amp;gt;::&amp;lt;/b&amp;gt;Page name{{rb}}&amp;lt;/code&amp;gt; are instead replaced by the current contents of [[Template:T]] or [[Page name]]&lt;br /&gt;
* &amp;lt;code&amp;gt;{{lb}}msgnw:T{{rb}}&amp;lt;/code&amp;gt; includes [[Template:T]] in &amp;lt;code&amp;gt;&amp;amp;lt;nowiki&amp;gt;&amp;lt;/code&amp;gt; style&lt;br /&gt;
&lt;br /&gt;
== If-templates ==&lt;br /&gt;
Templates have a limited condition-testing functionality. The following are based on code from the MediaWiki manuals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;{{lb}}Ifn|&amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt;{{rb}}&lt;br /&gt;
&amp;lt;dd&amp;gt;&lt;br /&gt;
Yields &amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt; if &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; isn&amp;#039;t blank.&lt;br /&gt;
(Compare shell&amp;#039;s &amp;lt;code&amp;gt;if [ -n &amp;quot;value&amp;quot; ]; then result; fi&amp;lt;/code&amp;gt;)&lt;br /&gt;
One limitation: {{lb}}ifn|2=&amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt;{{rb}} yields &amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt; (but works properly if &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; is defined and empty).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;{{lb}}Ifz|&amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt;{{rb}}&lt;br /&gt;
&amp;lt;dd&amp;gt;&lt;br /&gt;
Yields &amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt; if &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; is blank.&lt;br /&gt;
(Compare shell&amp;#039;s &amp;lt;code&amp;gt;if [ -z &amp;quot;value&amp;quot; ]; then result; fi&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;{{lb}}If|&amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt;{{rb}}&lt;br /&gt;
&amp;lt;dd&amp;gt;&lt;br /&gt;
Yields &amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt; if &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; isn&amp;#039;t blank; otherwise it yields &amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt;.&lt;br /&gt;
(Compare shell&amp;#039;s &amp;lt;code&amp;gt;if [ -n &amp;quot;value&amp;quot;]; then resultyes; else resultno; fi&amp;lt;/code&amp;gt;)&lt;br /&gt;
One limitation: {{lb}}if|2=&amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt;{{rb}} yields &amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt; (but works properly if &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; is defined and empty, or &amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt; is defined).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;{{lb}}Ifeq|&amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;test&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt;{{rb}}&lt;br /&gt;
&amp;lt;dd&amp;gt;&lt;br /&gt;
Yields &amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt; if &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; equals &amp;lt;var&amp;gt;test&amp;lt;/var&amp;gt;; otherwise it yields &amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt;.&lt;br /&gt;
(Compare shell&amp;#039;s &amp;lt;code&amp;gt;if [&amp;quot;value&amp;quot; = test ]; then resultyes; else resultno; fi&amp;lt;/code&amp;gt;)&lt;br /&gt;
&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that we&amp;#039;ve upgraded to MediaWiki &amp;gt;= 1.19.1, though (currently at 1.26.2), we &amp;lt;em&amp;gt;would&amp;lt;/em&amp;gt; be able to use {{lb}}#if:&amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;result&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt;{{rb}} and {{lb}}#ifeq:&amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;test&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultyes&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;resultno&amp;lt;/var&amp;gt;{{rb}}, which don&amp;#039;t suffer the above limitations. Here are [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions more details.] However, it seems that won&amp;#039;t work until the ParserFunctions extension [[Special:Version|is enabled]].&lt;br /&gt;
&lt;br /&gt;
== Template arguments ==&lt;br /&gt;
&lt;br /&gt;
In the template&amp;#039;s expansion markup, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{{&amp;lt;/nowiki&amp;gt;1}}}&amp;lt;/code&amp;gt; will expand to the first (implicitly named) argument, and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{{&amp;lt;/nowiki&amp;gt;2|&amp;lt;var&amp;gt;default&amp;lt;/var&amp;gt;}}}&amp;lt;/code&amp;gt; will expand to the second but default to &amp;lt;var&amp;gt;default&amp;lt;/var&amp;gt; if the second argument is not supplied. Note that if the template is invoked as &amp;lt;code&amp;gt;{{lb}}Foo|arg1|{{rb}}&amp;lt;/code&amp;gt;, then the second argument &amp;#039;&amp;#039;has&amp;#039;&amp;#039; been supplied; here it&amp;#039;s the empty string.&lt;br /&gt;
&lt;br /&gt;
Arguments can also be explicitly named/numbered, as when you invoke &amp;lt;code&amp;gt;{{lb}}Foo|bar=arg1|2={{rb}}&amp;lt;/code&amp;gt;. Arguments supplied in these ways have leading and trailing whitespace trimmed. (Whitespace is preserved when arguments are only implicitly named.)&lt;br /&gt;
&lt;br /&gt;
To suppress expansion of an argument&amp;#039;s contents, wrap &amp;lt;code&amp;gt;{{{&amp;lt;var&amp;gt;argument&amp;lt;/var&amp;gt;}}}&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;{{lb}}#tag:nowiki|...{{rb}}&amp;lt;/code&amp;gt;; see [[Template:Cat]] for an example.&lt;br /&gt;
&lt;br /&gt;
Inside a template&amp;#039;s expansion markup, substrings beginning with &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; are automatically prefixed by a &lt;br /&gt;
newline. Use &amp;lt;code&amp;gt;start&amp;lt;nowiki&amp;gt;{{{&amp;lt;/nowiki&amp;gt;&amp;lt;var&amp;gt;dummy&amp;lt;/var&amp;gt;|&amp;lt;b&amp;gt;;&amp;lt;/b&amp;gt;}}}finish&amp;lt;/code&amp;gt; to generate &amp;lt;code&amp;gt;start&amp;lt;b&amp;gt;;&amp;lt;/b&amp;gt;finish&amp;lt;/code&amp;gt;. (The empty string may be used for &amp;lt;var&amp;gt;dummy&amp;lt;/var&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;{{lb}}ns:0{{rb}}&amp;lt;/code&amp;gt; expands to the empty string.&lt;br /&gt;
&lt;br /&gt;
If your template arguments are unexpectedly expanding as {{{1}}}, then you neglected to supply the argument; or you supplied text that the wiki markup engine is interpreting in a way you didn&amp;#039;t expect. You can stop this from happening by surrounding the relevant text with &amp;lt;code&amp;gt;&amp;amp;lt;nowiki&amp;gt;&amp;lt;/code&amp;gt; tags. For example, instead of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Cmd|export PS1=&amp;quot;(chroot)$PS1&amp;quot;}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Cmd|&amp;amp;lt;nowiki&amp;gt;export PS1=&amp;quot;(chroot)$PS1&amp;quot;&amp;amp;lt;/nowiki&amp;gt;}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A shorter alternative is to explicitly name the first argument:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Cmd|1=export PS1=&amp;quot;(chroot)$PS1}&amp;quot;}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Help:Editing#cat|the escape characters for {{lb}}Cat{{rb}}]], which can be used inside any template invocation.&lt;br /&gt;
&lt;br /&gt;
== Skeleton for a new template ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
Short description.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Longer description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Foo|arg}}&amp;amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Further comments.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Foo|arg}}&amp;amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce:&lt;br /&gt;
{{Foo|arg}}&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
&lt;br /&gt;
* [[:Template:Bar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;EXPANSION&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lynn</name></author>
	</entry>
</feed>