Skip to Page Content

Tips\templates

From WolfWikis

Jump to: navigation, search

This wiki software allows the creation of templates.

Contents

Purpose

They make it possibile to insert the same information on various ('tagged') pages and modify it on all of them at once.

Creating

Creating a template is easy in principle. Make up a suitable name, e.g. test1, edit a page where the template is supposed to be tagged unto and type {{test1}}. Once saved a red link appears on the page that says: Template:Test1. Another way of creating the same template is to search for 'Template:Test1'. The search will in general be unsuccesful (unless someone else already created it!) and the system will invite you to create it.

Editing

When you click on the Template:Test1 link an editing page appears and you can insert text. Once saved this text will replace the red link Template:Test1 on all pages where the {{test1}} has been tagged.

Say we entered '''<big>Wolfpack!!</big>''' on the edit page of the template. Wolfpack!! would now be shown on all pages that carry the template {{test1}}.

Parameters

Although it possible to use a template just to put a text remark on a bunch of pages at once, templates can be constructed that are much more involved. E.g. we can use parameters to modify the displayed contents of the template on each page bit.

If we modify the contents of the template page to '''<big>Wolfpack {{{1}}}!!</big>'''. The {{{1}}} indicates that the contents of a first parameter would be displayed as well.

Then on one tagged page we could write {{test1|sucks}}} to get a result Wolfpack sucks!! and on another page we could use {{test1|rules}}} to get Wolfpack rules!!

In short the value of the parameter {{{1}}} can be specified by the value after the pipe | symbol

Numbered and named parameters

The above {{{1}}} is an example of a numbered parameter. We can use more than one if we write {{test1|a|b|c|d|e}} we would be calling for {{{1}}}} to be ''a'' and {{{5}}} to have a value of 'e' . It is also possible to use names like {{{game}}}, but then on the tagged page we would have to write e.g. {{test1|game=today}}. With many parameters this is often handier

Defaults

We can add a default for the case that the parameter value is left out by using a pipe, e.g. {{{1|rules}}} would make sure that 'rules' is displayed unless a different value is given in the tag.

Categories

It is possible and even desirable to include category statements into a template. This way all pages tagged with the template will be automatically put in one and the same category. See Tips\categories for an introduction to the use of categories.

More?

See templates and advanced templates at meta

Personal tools

Wiki Stats

Users:  7,047
Pages:  3,895
Uploads:  4,707
Views:  4,404,899
Edits:  90,621