From WikiTemp, the GBAtemp wiki

Templates

Hi, maybe it's only for admin to use it, but I would like a tutorial on how to create and use a template. I know the {{template name}} thing, for simple template like {{List Ranges}} it's easy to understand and use.

But I don't know how it can change an article's data with complexe template. For exemple the NDS compatibility template {{Slot-1 Compatibility}} use {{{1}}}, {{{2}}}. Is that a mask for data written by a user, so if you change the template the data filled by a user is left as is ? What the subst: stand for ?

Maybe you are still testing it because I didn't see this template in the NDS compatibility list article.

--Cyan 13:22, 5 March 2007 (CET)

The Wikimedia's help page about templates might be of help. But I guess having a short description in GBAtemp's wiki wouldn't hurt either.
Anyway, {{{1}}} means the first parameter given to the template, {{{2}}} means the second parameter, etc. So if you call the template like this {{Template|parameter1|parameter2}}, {{{1}}} will be replaced with parameter1, and {{{2}}} is replaced with parameter2. Don't remember what subst: is though... --Mythril 13:54, 5 March 2007 (CET)
Thank you for your answer, I'll read it. --Cyan 14:14, 5 March 2007 (CET)
The compatibility list is a bad example, simply because it is using some quite complex custom extensions. Mythril is on the money though. Triple {} brackets means a user-specified parameter that will be passed to the template, and double {} brackets are what you use to call the template. An easy to understand example would be this page. It uses 3 simple templates (which have links at the bottom of the page).
Note that parameters are not required to be numbered, it just makes it easier when calling the template. For example they could be called {{{hello this is a parameter}}} or {{{blah}}}, but to call the template you'd have to insert something along the lines of:
{{template name|hello this is a parameter=what user sees for this parameter|blah=what user sees for this parameter}}
This page explains templates very nicely (and supersedes the link posted further up the page) Dirtie 11:10, 6 March 2007 (CET)
Edit: I forgot to mention that the subst: command substitutes the contents of the template into the page directly when it is saved.
So let's say we had a simple template named "Template:simple" consisting of:
Contents of template, an {{{1}}}
Then we put the following into a page:
{{subst:simple|example}}
If we saved the page and took a look at the source, we'd see it had changed into:
Contents of template, an example
It's useful if you do not want the page to change dynamically whenever the template is modified (but can make pages messy or unnecessarily long)
Thank you Dirtie. I found the mediawiki link on wikipedia yesterday, it was very helpfull and easy to understand. It will help other users too.
I think for NDS list, it's an additional script that check the data and replace it with javascript. I just wanted to understand how the process worked before editing anything. --Cyan 12:13, 6 March 2007 (CET)