Jump to content

Help:Templates

From SeptemWiki
Revision as of 18:50, 19 March 2016 by Shawn (talk | contribs) (Created page with "'''Templates''' are pages which can be included inside other pages by using the <code><nowiki>{{ }}</nowiki></code> syntax. == How the syntax works == At a basic level, if y...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Templates are pages which can be included inside other pages by using the {{ }} syntax.

How the syntax works

At a basic level, if you put {{Namespace:Page}} into your page, then at that point, the contents of the page Namespace:Page will be included, regardless of the page.

For pages that are generally intended to be used as templates, if you put them in the Template: namespace, then you don't need to specify the namespace when using the curly braces, because that's what it assumes by default.

A template can be as simple as you like; if I create a page called Template:Jerkface and it just contains "Shawn Knight", then every place we put {{Jerkface}} in the wiki, "Shawn Knight" will appear. But then simply by editing Template:Jerkface to say "Alan Caum", every page which uses the template will show Alan's name instead.

Templates with Parameters

At a more advanced level, a template can have parameters, separated inside the curly braces by vertical bars. And generally a parameter has a name and a value.

Here's an example of an info box for a service plaza, using the PlazaBox template, with a number of parameters.

Sideling Hill Plaza Service Plaza

The plaza entrance
Direction Eastbound and Westbound
County Fulton
State Kalmont


Editing Templates

Not everyone with permission to edit an article has permission to edit templates, because you have the potential to break a lot of pages if you screw one up. If you need a template for something, either ask Shawn to do it or show him that you're really comfortable with the syntax.

All Template Pages