Help:Template
From NOTE Wiki
A template is a page that is used multiple times as a piece of other pages. They belong to the Template namespace.
Creation
Templates are created in the template namespace. The page name of a template named "Template", then, is "Template:Template". The page name of a template named "Template2" is "Template:Template2". Here is a list of all templates in use on NOTE Wiki.
Template coding works much like other pages. A template, however, can take arguments, which are indicated by three pinched brackets, like so: {{{argument}}}.
Transclusion and Substitution
A template is added to a page using two pinched brackets.
{{test}} adds Template:Test to the page. If Template:Test includes this code:
{| border="1"
|-
| This is a template! {{{1}}}
|}
then {{test}} creates this:
| This is a template! {{{1}}} |
(Note: this is a wikitable. For instructions on creating tables, see Help:Table.
This is called "transclusion". The contents of the template are added to the page being edited, but are not visible when you click "edit this page". The content of the edited page will reflect the content of the template; if the template is edited, the content in the page on which it is transcluded will also change.
A template can also be "substituted". Adding the "subst" qualification to the page being edited, like so
{{subst:test}}
will replace the template transclusion with the code contents of the template page. After you save the page, the pinch bracket transclusion will no longer be visible, and the code from the template can be edited on the page in question without altering the original template.
Arguments
In the above code, {{{text}}} is an "argument" in the template. Arguments are added to a template page in three sets of pinch brackets. On the page in which the template is transcluded, the value of the argument is added to the template transclusion after an I-Bar, "|". So to replace the "text" with "Hello!" in the above, use this:
{{test|Hello!}}
to get this:
| This is a template! Hello! |
A template can have multiple arguments; successive arguments are qualified in the page after successive I-Bars.
Some templates have named arguments; rather than numbers within the pinched brackets, they names. In these cases, you must include the name of the argument and "=" in the template transclusion. For an example of this, see Template:Infobox Club.
