Help:Templates

Templates enable you to do things much faster and/or easier. Templates are used very frequently on pages, so it's best to learn about them. When the wiki sees a template it recognizes on a page, it will automatically replace it with something else. What appears there is up to the users.
 * How to use a template
 * Making templates
 * Templates not updating
 * Useful templates
 * Miscellaneous
 * See Also

How to use a template
Before a template can be added somewhere, first its contents must be defined on its own page. Template pages should start with the prefix.

Templates have some limited programming abilities, which gives them lots of possibilities. We'll talk more about those later.

To add a template to a page (which is called transcluding), simply type, the name of the template, and then. If you wish to add any parameters, put a  between the template's name and the , and define the parameters there. All parameters you define need to be separated by another.

Examples
Here's a template where we don't define any parameters, you just drop it right in. Result:

If you visit this template's page, you'll see that its just those five words.

Template:cl can accept up to two unnamed parameters. Result:

Unnamed parameters must be defined in a specific order.

Template:KIO is one of the most common templates used. It accepts an optional named parameter.

Result:

Without the  at the end, the (available in all games since ) message would not have displayed. Named parameters can be defined in any order. Unnamed parameters may also be defined this way, such as:.

Templates can also use templates (nesting). In the KIO template above, the  part adds Template:nofgd into the page, which is the  bit.

Substitution (advanced)
Instead of transcluding a template, one can choose to substitute it. Substitution will replace a template with the contents of the template directly onto the page. To substitute a template, transclude it like you normally would, then add  between   and the template's name. After that, click the save button and the wikitext will automatically be added. Do not substitute carelessly, because the substituted wikitext will not be updated when the template is. See Wikipedia:Help:Substitution for more information. This is a bad page. When the page is saved, that text will be replaced with this: Note the automatic forwarding of parameters. When substituting, the page should not appear any differently than it would if transcluded. The only difference is in the page code.

Making templates
Making a template like Template:Restart is rather easy - just type the text you want, and save it. What about ones with parameters?

Unnamed parameters
To add an unnamed parameter, simply put  where you want it to be.

Here's (basically) the code for Template:Tip: Tip: If you've seen this template before you know that it has more to it, but this is all we will look at for now. All the user has to do when transcluding this is enter the text they want: Result:

If you want to add more than one unnamed parameter, simply change the number. Here's some (condensed) code for Template:KIO: ;

This template has some things we haven't talked about yet, but you can still see that there's three unnamed parameters used:,  , and.

All the user has to do when transcluding is this: Result:

Named parameters
Named parameters can be useful too as they can be defined in any order, and can be easier to understand, however they do take longer to type. In Template:Oldnote,  marks a place to add wikitext that's defined by   when transcluding.

With named parameter: Result:

Without named parameter: Result:

Default value
To make a parameter have a value by default, add a  to the right of the parameter name, and then define the value. Named and unnamed parameters can use this. This would make the value for. This returns ", it would literally return "" as text, if it hasn't already been assigned a value at some other point.

Parser Functions
checks if a string or parameter has anything inside it. Result: (The parameter   returns null because you (probably) are not viewing this page through a transclusion, so it's never had a chance to be defined.) Result:

checks for equality between two strings. It can be used with parameters as well. Result: Result:

solves math problems. Result:

See m:Help:Calculation for all it's abilities.

tells if a math expression is correct. Result: Result:

Documentation
Please give a description of what your template is, and maybe examples. To keep this describing text from appearing on pages, there are 3 different HTML tags you can use.

keeps wikitext inside it from appearing on the destination page, while keeping it on the source page.

makes only wikitext inside it appear on destination pages. Text not inside these will still appear on the template's page.

wikitext inside this will not appear on the template page. It has no effect on the destination page however.

They can sound very confusing at first. If you're confused on how to use them, check the source code for a template, because almost all use them for one purpose or another. If a template's purpose can be understood with a quick glace, skip the documentation.

Templates not updating
If you've recently edited a template and the changes are not applying on pages it's been transcluded to, add  at the end of the URL for those pages. This will tell the server to update the page's HTML immediately. You can achieve the same effect by editing a page and saving it without making any changes.

per-game templates
All games have templates that show their associated icon. (e.g. ) See Category:Game icons for the full list.

=
Template:= is a template that only returns an equal sign. The character is sometimes needed because multiple wiki features make use of it. An equal sign generated through this will never be counted as formatting.

bug
Template:Bug notifies readers of a bug. Result:

clarify
Template:Clarify marks things that should be clarified. PAS is a kind of bounding-box for Player or NPC AI sound detection. Result: PAS is a kind of bounding-box for Player or NPC AI sound detection.

cleanup
Template:Cleanup marks a page that needs to be fixed up, preferably by someone knowledgeable. Result:

clr
Template:Clr clears the vertical space to the left or right of something. This is commonly used for making headlines not get moved around by images.



This text should appear next to the image. If you put  right after this,

this bit of text here will get moved down.



This text should appear next to the image. If you put  right after this,

this bit of text here will get moved down.

confirm
Template:Confirm marks something that needs to be confirmed. Result: Always goes to the left. Result: Always goes to the left.

delete
Template:Delete marks a page that should be deleted. Result:

distinguish
Template:Distinguish lets you notify users about pages that share similar names or may be confused for something else.

Example from Follow Freeman: Result:

ent
Template:Ent is a really small template for making text that's both code and a link. Result:

ExpandBox
Template:ExpandBox allows you to hide stuff inside a box that can be shrunk down so that it doesn't make pages as long. Result:

how
Template:How asks the question how? Players can get past these. Result: Players can get past these.

idea
Template:Idea is a nifty way to suggest ideas. Result:

merge
Template:Merge is a notice that notifies editors that it's been suggested for two or more pages to be combined into one. All merges should be discussed before being done. Result:

messagebox
Template:Messagebox provides a standard message box. This template is used by many notice templates, such as merge and cleanup. Result:

morescreenshots
Template:Morescreenshots marks pages that should have more images on them. Result:

note
Template:Note is for making notes stand out more.

Result:

obsolete
Template:Obsolete marks things that should no longer be used. Result:

otherlang2
Template:Otherlang2 is used for linking to versions of pages in other languages. For an example of its use, see the Main Page.

shortcut
Template:Shortcut displays a small box noting (abbreviated) redirects to a page. Result:

spammer
Template:Spammer marks users that should be banned for spamming. Result:


 * [&wpBlockExpiry=infinite&wpHardBlock=1&wpAutoBlock=1&wpCreateAccount=0$wpBlockEmail=1&wpBlockReasonList=Spamming Block this user.] (Requires admin rights)
 * [ Check if this user has been banned.]
 * View this user's contributions.

split-apart
Template:Split-apart marks pages that should be split into multiple pages. All splits should be discussed before being done. Result:

stub
Template:Stub marks pages that are very small. See Help:Stubs for info on using. Result:

tip
Template:Tip marks text as a tip to readers. Result:

toc-right
Template:toc-right shifts the table of contents over to the right side of a page. For an example, see Half-Life 2 map reference.

todo
Template:Todo marks things that need to be done. It's green color is meant to stand out. Result: To do Find where this is in the game files.

unsigned
Template:Unsigned is for talk pages. It should be added at the ends of unsigned comments. Result:

update
Template:Update marks outdated pages. Result:

warning
Template:Warning marks things that readers should take caution of when doing something. Result:

why
Template:Why asks the question why? This shader has been deprecated. Result: This shader has been deprecated.

wip
Template:Wip marks pages that are in the middle of major edits. The adder requests that other users do not edit in the meantime. Result:

Magic words
Magic words are special character strings that are kind of like templates. To apply one, simply type it on the page.

Forces the table of contents to be placed at this spot.

Forces the table of contents to be placed at its normal spot. (Only useful on pages that don't have enough sections to automatically display a TOC.)

Hides the table of contents.

Marks a category as hidden. To make the website show hidden categories for you, check the Show hidden categories box in Special:Preferences.

Changes the title of a page at the top bar only.