Fandom

Archived Help Wiki

Halp:Creating templates

129pages on
this wiki
Add New Page
Talk0 Share
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?Edit

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 I use parameters in a template?Edit

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:

{{box|text}}

...might produce a box containing text.

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.

How do I use parser functions in a template?Edit

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:

{{#if: {{{input|}}} | {{!}}-
{{!}} {{{input}}} }}

Produces the following code only if the input parameter is defined.

|-
| {{{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.

The "/doc" subpage systemEdit

In the early years of Wikipedia and Wikia, template documentation (if any) was either on the talk page or (in "noinclude" tags) on the template page itself. For various reasons, including problems of template protection, both organizations have moved to standardize documentation on separate "/doc" subpages. Wikia virtually completed the process in late 2008. All Wikia sites created earlier were given few or no such "/doc" pages. Contributors to such sites are urged to create separate documentation subpages following the new standard, wherever convenient. See the Starter Wikia for pages that can be freely copied as part of the process. That wiki adds new pages from time to time and is therefore worth checking at intervals.

See alsoEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.