Help:Templates: Difference between revisions

m
no edit summary
m (1 revision: pages)
mNo edit summary
Line 1: Line 1:
{{helppage}}
A '''template''' is a page, like its title says, a page which can be included into any other page, and sometimes be customized. This page gives tips on creating and using templates.
A '''template''' is a page, like its title says, a page which can be included into any other page, and sometimes be customized. This page gives tips on creating and using templates.
== Creating templates ==
== Creating templates ==
Line 7: Line 8:
Sometimes, you may want to write about the template on its page (often to explain how and when to use it), but you don't want this text to appear on the template itself.  To do this, you should enclose such text with <nowiki><noinclude> and </noinclude></nowiki> so that it does not appear on every page you use the template on.  An example can be found in the {{tl|policy}} template.  Below the box is a line of text that does not appear on policy pages. The opposite can also be made, by writing <nowiki><noinclude> and </noinclude></nowiki> tags around to only make text appear when included. This is very useful for categories.
Sometimes, you may want to write about the template on its page (often to explain how and when to use it), but you don't want this text to appear on the template itself.  To do this, you should enclose such text with <nowiki><noinclude> and </noinclude></nowiki> so that it does not appear on every page you use the template on.  An example can be found in the {{tl|policy}} template.  Below the box is a line of text that does not appear on policy pages. The opposite can also be made, by writing <nowiki><noinclude> and </noinclude></nowiki> tags around to only make text appear when included. This is very useful for categories.


== Modifyers ==
==Modifiers==
=== Non-template namespace ===
===Non-template namespace===
By writing <nowiki>{{Namespace:Page name}}</nowiki>, pages from various namespaces can be included. To include namespaceless pages, <nowiki>{{:Page name}}</nowiki> should be written.
By writing <nowiki>{{Namespace:Page name}}</nowiki>, pages from various namespaces can be included.
=== Substitution ===
===Substitution===
Templates can be substituted by writing <nowiki>{{SUBST:Template name}}, {{SUBST:Namespace:Page name}} or {{SUBST::Page name}}. By writing {{SUBST:Example}}</nowiki>, the content on {{tl|Example}} is placed on the page instead of just <nowiki>{{Example}}</nowiki> when someone edits.
Templates can be substituted by writing <nowiki>{{SUBST:Template name}}, {{SUBST:Namespace:Page name}} or {{SUBST::Page name}}. By writing {{SUBST:Example}}</nowiki>, the content on {{tl|Example}} is placed on the page instead of just <nowiki>{{Example}}</nowiki> when someone edits.
<noinclude>
===Linking===
{{stub}}
To link to a template without inserting it, use brackets instead of curly braces.
</noinclude>
*<nowiki>[[Template:Policy]]</nowiki> will link to [[Template:Policy]]
*<nowiki>{{policy}}</nowiki> will insert that template into an article.
 
[[category:help|Templates]]
[[category:help|Templates]]
[[category:Templates| ]]
[[category:Templates| ]]