Help:Templates

From NANOG

Jump to: navigation, search

Contents

Templates are pages that can be included inside other wiki articles.

Creating templates

You may create a template in the same way you create a normal page, but you must use the namespace template: before the template name. Example: Template:Custom Title

Includeonly and Noinclude

That page was edited just like any other wiki article, but, as you can see, there are two interesting tags within it. The first is the <includeonly> tag. The <includeonly> tags are used to add text and code to a template that will only be used when the template itself is called. This is usally used to categorise pages the template is placed on, without giving the category to the template itself.

The second tag is the <noinclude> tag. The <noinclude> tags are used to add text and code to a template that won't be used when the template itself is called. This is mostly used to add categories to the template itself, and usage comments when parameters are needed. For more help with categories, look at Help:Categories.

Template Usage

You can make a simple template call by using {{TemplateName}}.

Example:

{{PLONK}}

will show as

P L O N K
You are being ignored.


Variable in Templates

Variables in templates are areas of the template that can be changed by whoever uses it. Template:KookLevel uses variables.

To create a variable, surround it in three sets of curled brackets, like so:

{{{ExampleVariable}}}

We'll use the template above as an example.

{| style="border:solid #556655 2px;" width=250 align="center"
|-
| rowspan=2 |  || style="background:#556655; color:#ffffff;" width=200 align="center" | '''Kookiness'''
|-
| align="center"  style="font-size: xx-small" | {{{User}}} is a currently {{{Level}}}
|}

Notice the variables {{{User}}} and {{{Level}}}. These can be set when the template is used. In this case, the user of the template would put it on thier page as follows. Notice the pipes to separate the variables:

{{KookLevel|User=JQRandom|Level=wearing a tin-foil helmet}}

The above will produce this:

Kookiness
JQRandom is wearing a tin-foil helmet


Handy Resources

When creating templates, keep the following resources in mind

Editing help
Editing basics

Advanced editing

Finding your way around the wiki

Page tricks

Advanced Timesavers

Communicating your edits

Misc

Policies and Guidelines
Guidelines


Policy Documents

Cribbed from the Urban Dead wiki and specifically the work of users Mia Kristos, Brizth, Odd Starter, and Xoid among many others.
Personal tools