Community Central
Community Central

Templates allow you to pass parameters that can be used to affect the content or design of the template.

Simple replacement

Using the example of a simple box, the following when placed on a template page called Template:Box:

<div style="width:10em; height:5em; border:1px solid #333; background-color:#666; color:#fff; text-align:center; padding-top:2em;">{{{1}}}</div>

Produces the following box on the template page:

{{{1}}}

Next, on an article, you could type:

{{box|text}}

This would produce:

text

This is because {{{1}}} tells the wiki to pass the first parameter of the template here. This can be extended with {{{2}}}, {{{3}}}, ad infinitum. The number represents the number of the parameter:

{{box|first parameter|second parameter|third parameter}}

If you wish not to use a certain parameter, you can leave it blank, but the | must still be included. For example:

{{box|first parameter||third parameter}}

Named parameters

Alternatively:

{{box|bgcolor=yellow|textcolor=blue|caption=A yellow house}}

...might produce a box with a yellow background and blue text, with a caption describing it as such.