Help:Templates

From Codex Gamicus
Jump to: navigation, search


Help Contents

Codex Gamicus Logo.png

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


Template help
Infobox Templates | General Templates
Array Templates | Switch Templates
Notice Templates | Navigation Templates
Substitution Templates | Navbox Templates
Icon Templates | Context Link Templates
Things To Do

User Page Help
Resolving disputes - Deletion - Talk pages
User pages
Codex Gamicus community
Community Portal - Userboxes - Admins
Admin nominations - Discussion Forums
Codex Gamicus Guidelines
Introduction | About | Site direction


Frequently Asked Questions
Policies & Guidelines
Vandalism - Manual of Style

Searching
Disambiguation pages | Current Events
Can't find a page?

Codex Gamicus Policies
Image Policy - Video game articles
Sub-articles

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.

Basic usage documentation template[edit source]

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
|usedfor	= [[Myst (series)]]
|dpl		= Partial
|optparam	= Yes
|reqparam	= No
}}
{{partautonote|Characters, Mythology|{{PAGENAME}}}}
Copy and paste the following:

<pre>
{{Myst}}
</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 GameInfobox.

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.

DPL[edit source]

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.

Character box[edit source]

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.

Info box[edit source]

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.

Movie box[edit source]

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.

Websites[edit source]

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.