Jump to content

User:Σ/Mentor/Spidey665/Templates

From Wikipedia, the free encyclopedia

Templates allow you to post large sections of text or complicated sections of code while only typing a few characters. Templates work similar to regular links, but instead of [[double square brackets]], you use {{curly braces}}. To call a template, just type the title of the template between the double braces. You don't need to include the "Template:" prefix; the MediaWiki software automatically searches within the Template namespace for what you're looking for. Only if the page you're looking for is in a different namespace do you need to specify it.

Source Result Notes
{{user en}}
enThis user is a native speaker of the English language.
This calls Template:User en. All content there (that is marked to be included, see below) appears where I type the template code.
{{Blast san/userboxes/User IQ|138}}
{{Blast san/userboxes/User IQ|138}}
I get a red link because no page exists at Template:Blast san/userboxes/User IQ.
{{User:Blast san/userboxes/User IQ|138}}
IQ This user's Intelligence Quotient is 138.
Specification of the User namespace causes the userbox to appear. This shows that pages from any namespace can be used as templates.

In the example using a specified namespace, you'll notice the |138 at the end. The usage of | means that you're invoking a parameter in the template.

A parameter is a (usually) optional argument a template can take, in order to alter the result. Using the code {{{1}}} on a template and then transcluding the template means that the text inserted into either |1= or the first unnamed parameter will appear where {{{1}}} was in the template's text. Named parameters, such as {{{article}}} mean that when the template is transcluded, using |article=ASDFGHJKL will make ASDFGHJKL appear where {{{article}}} was in the template's text.

To make a parameter default to a certain value, simply change {{{parametername}}} to {{{parametername|This is all the default text until three }'s are encountered, if parameter is unspecified when transcluded; {{aiv}} as opposed to {{aiv|warn}} for instance}}}.