Help:Templates

(Extracted from http://wiki.mindcloud.org/wiki/Templates ;-D)

Contents

Introduction

By now you may have established many of the more common wiki editing skills. In this guide you will be shown the top of the rabbit hole that is templates. (How deep does it go?)

Templates are mainly used to reduce effort where the contributor finds themself writing the same block of wiki code over and over again. They can also, as the name suggests, act to unify the appearance of a certain class of pages.

They also look a lot more tidy than the mass of code that they often replace.

Intrigued? Read on!


Template Basics

1.Creating a basic template

http://proto.mindcloud.org/Helicopterbasic.jpg Tristan Miller

each and every time I wanted this:

Helicopterbasic.jpg Tristan Miller

to appear.



http://proto.mindcloud.org/Helicopterbasic.jpg Tristan Miller

2.Using the basic template

Now whenever I want my name and symbol to appear, in the page source I just write TJM inside a pair of double curly brackets:

{{TJM}},

and the effect is:


Helicopterbasic.png Tristan Miller.


The beauty of this method is that any changes I make to the template effect all the pages that I've used it on. So if I decide my moniker is embarassing at some point, I won't have to pick my way through the wiki searching for all the pages I've used it on.


3.Creating a template with parameters

This is rather easy to do: instead of specifying the name and image URL in the template, I replace these values with parameters. It helps to give these parameters sensible names, so I'll call the name parameter Name, and the image parameter MonikerURL. In the template page source, each must be inside a pair of triple curly brackets, like so:

{{{MonikerURL}}} {{{Name}}}

This I put in a page named Template:MonName.


4.Using the template

When ready to use this new template, the magic words to enter in the page source are:

{{MonName|MonikerURL=http://proto.mindcloud.org/images/smallprotoMindcloud.png|Name=Arthur Pembleton}}

For the sake of tidiness, it is preferable to put a carriage return before each parameter:

{{MonName|
 MonikerURL=http://proto.mindcloud.org/images/smallprotoMindcloud.png|
 Name=Arthur Pembleton
}}

Either way, the result is:

smallprotoMindcloud.png Arthur Pembleton


In this case, it would actually be more effort to use the template. Of course this makes it useless, but the ability to slot in parameters can be applied to much more meaningful situations.

More advanced tips


That's about all I can tell you about this useful feature. If you'd like to know more about templates, refer to this page for horrible amounts of information about the use of templates.

Personal tools
Namespaces
Variants
Actions
Navigation
Tools