From Grand Theft Wiki
Revision as of 20:26, 27 June 2011 by Gboyers (talk | contribs) (A bit of rewording)
Jump to: navigation, search

Templates are used on Grand Theft Wiki to insert the contents of a template into a page.

This can be used for messages like {{help}}, navigation boxes like {{gta}}, Userboxes, or more complicated templates that take input, such as {{template}}.

Templates are all stored at [[Template:Templatename]]. They can then be included into a page using the code {{templatename}}.

Whatever is on the [[Template:Templatename]] page will then show up in every instance of the {{Name}} tag on Grand Theft Wiki. If you change the template, every page using it will change too.

Templates that require input are used like this: {{templatename | Option 1 | Option 2}}. In the code of the template, those options are referenced as {{{1}}} and {{{2}}} etc. There are also options with specific names, such as {{templatename | title=Hello}}, which is referenced in the template code as {{{title}}}.

For example, {{help}} shows up the banner at the top of this page. It is defined at Template:help. That template shows the banner and also assigns any page it is used on to a category, which is Category:Help. Not all templates do this.

Whenever the template is edited, each page that uses that template will change too. If you just want the template contents copied into the page rather than actively linked, you can use {{subst templatename}}. Subst simply includes the contents of templatename once.

Any page can be used as a template, by putting a colon (:) at the start of the tag. {{:Help:Templates}} would show the contents of the Help:Templates page.

Also, subpages can be used as templates (or links) directly with a slash (/) then the subpage name. Grand Theft Auto IV quickly includes it's subpage Grand Theft Auto IV/infobox with the tag {{/infobox}}.