A Wiki Template is a wiki article that can be inserted in other articles. You can use templates to define common content that will be included in multiple articles (for instance, a disclaimer, instructions, or guidelines), and then when you want to include that content in an article, you simply reference that template. This is done using the
template bbcode. The standard syntax for this is:
[template]Template Name[/template]
Wiki Templates support named and numbered variables; by default, these are auto-numbered in the following syntax:
[template]Template Name|var1|var2|var3[/template]
In the above example,
var1,
var2, and
var3 are the values of numbered variables
1,
2, and
3, respectively. Using named parameters is only slightly different:
[template]Template Name|name1=value1|name2=value2|name3=value3[/template]
In the body of the template, a Wiki article by the same name which we request that you place in the
Templates wiki forum, you can use arguments passed in with the following syntax:
{{{variable|default}}}
Variable is the name of the argument or variable (or its number if using numbered parameters).
Default is totally optional, and specifies the value of that parameter if a template were to be called without the corresponding variables defined.
Templates in Practice
Let us say that you created a Template titled
Tip, and the content of this template wiki article is:
[b]Did you know?[/b] - {{{1}}}
Notice above that the template calls for the first numbered variable,
1, which refers to the first parameter passed when calling the template. Then, when you wish to use the template in a wiki article, the following syntax can be used:
[template]Tip|Some tip text here.[/template]
In this example, we used numbered arguments, variables for which no name is specified. If you have many arguments, it may be more beneficial to name them as discussed previously and calling them by their names, giving them default values when it is sensible to do so.
For more information about Wiki bbcodes, please see the
Wiki Help article.