Help:Creating templates

A template is a piece of text (including tables, pictures, and code) that can be included into other pages. This allows that text to be edited in one place and then updated on many pages at once.

A template is any page in the template namespace, which means any page beginning with "Template:", such as Template:Templatename.

For basic information on how templates work, see Help:Templates.



How do I create a template?
Create a page in the Template namespace, by creating it with the title "Template:Your_template_name". The template name can include spaces and symbols, but you will want the name to be easy to remember and easy to type, so the shorter and simpler the better.



How do use parameters in a template?

 * Main article: Help:Template parameters

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

For example:

...might produce a box containing.

Alternatively:

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



How do use parser functions in a template?

 * Main article: Help:Parser functions

Parser functions allow you to use a little bit of programming logic in your templates, including "if" statements and basic calculations. For instance, you can hide table rows which contain empty parameters by using:

Produces the following code only if input is defined.


 * input
 * input

is used in the above parser function instead of | as the extension uses | to separate parameters. is a template at Template:! which transcludes | into the code after the parser function has been validated.