Templates on wikis are bits of code or design used to provide ease while editing a wiki. For example, NeoWikis often use Template:Infobox. Viewing the code, readers would find massive piles of symbols and text! Luckily, however, we can write templates to make the complex processes a little easier (for the general editors - someone has to write the templates of course!)


[edit] Creating a Template

Before an editor can even begin on the structuring of the template, he or she must create the page. Templates are in a special group, so all have the Template: prefix. Without this, an editor would just be creating a typical page!

[edit] Choosing What To Do

When designing a template, editors have two options: one that can be customized, or one that is solely used to call information. Typically, wikis use templates that can be customized vs. those that call pre-written information, but both cases can be used. This guide will cover how to write the first kind, as learning those and using them as escape sequences allow for the easy second kind.

[edit] Parameters

Templates use parameters to gain information. These are fields that can be filled in with information that will be displayed within the template.

{{{1}}} creates a parameter called 1; users don't have to write 1 = in template call
{{{name}}} creates a parameter called name; requires users to write name = in template cal;
{{{1|}}} declares a parameter called 1; does not have to be filled in for the template to work (in most cases)
{{{name|}}} declares an invisible parameter called name; will not appear unless specified in template call

[edit] Designing the Template

Though parameters are almost necessary within a template, design is also a must. Be it true formatting, or simple code, a template must be designed somehow. One example of a basic template is Template:FutureLink on the Ratchet and Clank NeoWiki. This template has one parameter and serves one purpose - to make linking faster on wikis. Most templates have multiple parameters, but almost always serve one purpose. These points are essential when designing a template.

As an editor, think about what you would want for ease. Here, I'll write a Table template called Template1, using three parameters: param1, param2, and param3. This template will be used solely to put information into a table. Normally, we would have to write all of this out:

{| class = "table table-bordered"
! colspan="2"| Video Games
| [[Game 1]] || [[Game 2]]

Time and time again, this can get exhausting. Through a template code, however, we can make this so much easier! On a page entitled Template:Template1, we would put:

{| class = "table table-bordered"
! colspan="2"| {{{param1}}}
| [[{{{param2}}}]] || [[{{{param3}}}]]

With that code, we have our first template! To see more complex templates, see our Parser Functions in Templates page.

[edit] Calling a Template

To call the template above (Template1) on any given page, we would simply write this code:

|param1 = Video Games
|param2 = Game 1
|param3 = Game 2

This code, on any given page, would output:

Video Games
Game 1 Game 2

And that, is a template guide in a nutshell. For further information regarding design and functionality, please see: