Help:Templates

From Minecart Rapid Transit Wiki
Jump to navigation Jump to search

In this article, we will visit what a template is and how to use them, along with some other things.

What is a template?

A template is a page that is different from others, in that the page itself isn't important, but the code underneath is. This code could create anything from coloured text to the fancy panel on the right we refer to as an infobox. The reason we use templates is that either the code is way too big, and would use lots of space, uses and/or stores information that otherwise would be hard to access, if accessible at all, or to create a standardised feature that would be used again and again.

How do they even work?

Usually, templates provide documentation or syntax, which is basically how you use them. First, you need two "curvy" brackets ({{) to open, or start calling, a template. You then need the template name, which will be the page name without the Template:. In most templates, there is then what's known as parameters, which allow you to customise the template to how you want or need it. To start one, use a pipe (|), and then type as requested by the documentation*. Once you've added all the parameters you need, then you can close the template with two closing curvy brackets (}}). What you do not want to do is just copy the text from the source, mess around with it, change it to how you want and just use that instead, since it will most likely use up space and include lots of code you don't need.

*= If there isn't any documentation, then you can either a) complain vigorously in all caps, b) ask in the Talk page of the template, or c) try and find out yourself, by going to Edit at the top (or view source if you're not a Trustee or it is protected) and looking for some {{{# or words here}}. If all else fails, ask someone online on the server, or ask Chief or Ben. But it shouldn't get that bad....

No, I meant how do I make one?

Oh, sorry. Well then, advanced user, it's quite simple: Create a page as you would, starting with Template:. (Bear in mind that the name of the page after the colon will be used when you want to call your template.) Then, just start making code! There are some things you will find useful, such as the <noinclude> and <includeonly> tags, which seperate what you see on the page and what you get when you call the template. To use parameters, you need to use {{{# or words here}}. This number or word or whatever will be used as the parameter. If it is a number, it is done in either chronological order (like {{test|param 1|oaram 2|param 3}}), or can go like words have to, by being called by its name ({{test|2=param2|78=param78|pi=param pie}}). I like Param Pie.

I wanna go back now...

...because I'm confused

Before I let you go, talk to someone on the Help talk:Template. Someone will be able to help you understand! Then you can go.

...because I've learnt so much!

Yeah, don't get cocky. Go back to where you came from. I hope you have learnt how to correctly use templates!