Help:Templates
Templates are "pages" that are intended to be included inside other wiki articles. The tend to be much shorter than normal pages, although they do not need to be so.
Note that the double braces - {{ }} can be used to include ANY page in a wiki article, but the Template name space is intended for pages that get used only in this fashion. As such, the "template" portion can be left out when putting the template page name inside braces.
There are also many useful design features that are intended ONLY for use on template pages, as they only have effect when the template page is included in and article, and are no at all on normal article pages.
Creating templates
You may create a template in the same way you create a normal page, but you must use the namespace template: before the template name. Example: Template:Custom Title
Includeonly and Noinclude
That page was edited just like any other wiki article, but, as you can see, there are two interesting tags within it. The first is the <includeonly>
tag. The <includeonly>
tags are used to add text and code to a template that will only be used when the template itself is called. This is usally used to categorise pages the template is placed on, without giving the category to the template itself.
The second tag is the <noinclude>
tag. The <noinclude>
tags are used to add text and code to a template that won't be used when the template itself is called. This is mostly used to add categories to the template itself, and usage comments when parameters are needed. For more help with categories, look at Help:Categories.
Template Usage
You can make a simple template call by using {{TemplateName}}.
Example:
{{DramaLlamaSmall}}
will show as
Drama Llama | |
The Llama is watching you. |
Variable in Templates
Variables in templates are areas of the template that can be changed by whoever uses it. Template:DrunkLevel uses variables.
To create a variable, surround it in three sets of curled brackets, like so:
{{{ExampleVariable}}}
We'll use the template above as an example.
{| style="border:solid #556655 2px;" width=250 align="center" |- | rowspan=2 | [[Image:Martini.jpg|40px]] || style="background:#556655; color:#ffffff;" width=200 align="center" | '''Sobriety''' |- | align="center" style="font-size: xx-small" | {{{User}}} is currently {{{Level}}} |}
Notice the variables {{{User}}} and {{{Level}}}. These can be set when the template is used. In this case, the user of the template would put it on their page as follows. Notice the pipes to separate the variables:
{{DrunkLevel|User=I|Level=so drunk, I can't use grammer}}
The above will produce this:
![]() |
Sobriety |
I is currently so drunk, I can't use grammer |
Handy Resources
When creating templates, keep the following resources in mind
|
|