Gaming
 

Help:Templates

From Wikia Gaming, your source for walkthroughs, games, guides, and more!

Help Contents

Image:Wikia-gaming-logo-header.png



Getting started
Introduction | About


Frequently Asked Questions
Policies & Guidelines
Vandalism - Manual of Style

Searching
Disambiguations | Current events | Can't find a page?

Editing
Basic Editing | Cleanup | Referencing | Images & Media |


Template help
Game Templates | General Templates
Things To Do

User pages
Resolving disputes - Deletion - Talk pages - User pages
Wikia Gaming community
Community Portal - Userboxes - Admins - Admin nominations- Discussion Forums - IRC channel


Templates are used to organize categories in the Encyclopedia. In most cases, using a template is as simple as inserting its' code:

{{Halo}}

Usage documentation can usually be found on the template page itself, in a section below the actual template; for example, to see Usage documentation for Template:Halo, go to Template:Halo#Usage.

Contents

[edit] Basic usage documentation template

To keep template pages uniform, there is a basic template to add that describes usage of your template. Copy and the paste the following at the very bottom of your template.

<noinclude>==Usage==
{{Templateinfo
|name		= Myst series
|usedfor	= [[Myst series]]
|dpl		= Partial
|optparam	= Yes
|reqparam	= No
}}
{{partautonote|Characters, Mythology|{{PAGENAME}}}}
Copy and paste the following:

<pre>
{{Myst series}}
</pre>

====Required parameters====
''There are no required parameters for this template.''

====Optional parameters====
''There are no optional parameters for this template.''

[[Category:Game Series Box Templates|{{PAGENAME}}]]</noinclude>

Information on the Templateinfo template can be found at Templateinfo usage. Other than that, the setup is fairly self-explanatory.

A required parameter is anything that the template requires beyond just the template call itself; for example, Templateinfo above requires the parameters name, usedfor, and so on. If your template can be called by just using its' name, e.g. {{Mytemplate}} then it has no required parameters.

An optional parameter is, as the name suggests, not required for the template to be called successfully. For an example of a template with both required and optional parameters, see Infobox.

If your template uses any sort of DPL-powered automation (see the section on DPL below), please make sure you note this in the Templateinfo call, and include the appropriate {{partautonote}} or {{fullautonote}} template call to let others know whether pages should be added manually or not. (See the partautonote and fullautonote templates for more information.) The call should be placed immediately below the end of the Templateinfo call.

[edit] DPL

DPL (Dynamic Page Listing; an extension to MediaWiki) is a way of automatically listing out pages within a certain category. In the context of templates, it can be used to automate the updating of templates when new pages are added.

For example, in the Halo template, it is used for the Factions, Characters, Equipment, Levels, and Books sections. Instead of manually editing the template when a new page is added for one of those sections, as long as the {{halo}} template code, along with the proper optional attribute, is used in the article page, the page will automatically show up in the template.

The basic code for using DPL in a template can be seen below:

<DPL>
category=Halo factions
skipthispage=no
mode=inline
inlinetext=&nbsp;|&nbsp;
replaceintitle=/ \(Halo\)/
</DPL>

Details on the code:

  • <DPL>
    This tag is used to start the DPL call.
  • category=Halo factions
    This attribute defines what category or categories are to be included in the list (in this case, Category:Halo factions). Separate multiple categories with a | (pipe) character. (On most keyboards it is shift+\ (backslash) to produce a pipe.)
  • skipthispage=no
    This attribute causes the current page to be included in the template display. In other words, if you are looking at the Cortana article, and this tag was not present, Cortana would NOT appear in the list of characters in the Halo template box on that page.
  • mode=inline
    This attribute causes the output of DPL to be inserted right where the DPL call is placed.
  • inlinetext=&nbsp;|&nbsp;
    This attribute causes the list of articles to be separated with a space, then a pipe character, then another space. This can be changed to, for example, a dash (-), or other characters if desired.
  • replaceintitle=/ \(Halo\)/
    Text within a page title can be replaced automatically, using regular expression syntax. In this case, several pages for the Halo section include  (Halo) for disambiguation, but displaying it for each and every page title in a list of titles about Halo is redundant. This code replaces all instances of  (Halo) with nothing.
  • </DPL>
    This tag ends the DPL call.

Much more information on DPL and various output options can be found in the DPL manual.

[edit] Character box

This section was left to preserve links, but the information within it was moved to help consolidate documentation into one place. Please refer to Characterbox template usage for information.

[edit] Info box

This section was left to preserve links, but the information within it was moved to help consolidate documentation into one place. Please refer to Infobox template usage for information.

[edit] Movie box

This section was left to preserve links, but the information within it was moved to help consolidate documentation into one place. Please refer to Movie Infobox template usage for information.

[edit] Websites

This section was left to preserve links, but the information within it was moved to help consolidate documentation into one place. Please refer to Website Infobox template usage for information.

A template is a special type of page that has been designed so its content can be included in one or more other pages. Since a given template can be included in many pages, templates can help reduce duplication and promote a uniform style between pages.

Templates are usually located in the Template namespace, which means any page name beginning with Template:, such as Template:Name. However, any page can act as a template.

Contents

Referencing templates

Transcluded template

The content of a template can be added to a page by referencing it using the wiki markup: {{templatename}}. This references the template and includes its output at the point of insertion. Articles will be updated automatically when referenced templates are changed. A page that references templates cannot be edited to change the content of a referenced template, although a list of referenced templates will be displayed at the bottom of the page for convenience while editing it.

Substituting templates

Substituted template

A different way to use a template is to substitute its content into a page. This is done by inserting subst: immediately after the opening braces: {{subst:templatename}}. Once the page is saved, the link to the template is removed and the template output is substituted in its place and can be further edited. Any updates to the template will not affect the content that was substituted into the page.

Benefits of templates

Templates are used to add recurring messages to pages in a consistent way, to add boilerplate messages, to create infoboxes and navigational boxes, and to provide cross-language portability of texts.

Templates can also make it much easier for new and casual editors to use advanced designs, features and extensions by hiding confusing code.

Creating a template

In short, create the text you want to have copied onto the target pages on a page in the Template namespace. Creating Template:Templatename will allow users to insert {{templatename}} into a page to display your text.

See Help:Creating templates for details.

For an overview, see the quick guide to templates on Wikimedia's Meta-Wiki.

Creating an advanced template

To learn how to change the output of the template based on what the user inputs, see Help:Template parameters and Help:Parser functions.

Updating and adding standard templates

Wikia's Starter Pages and Templates wikis occasionally improve some of their documentation as well as adding new templates specifically designed for Wikia sites, and are therefore worth checking from time to time. For sites created before about December 2008, the Starter Pages wiki should be compared and ideally used for upgrading to its standard documentation system similar to that introduced in Wikipedia.