Help:Templates: Difference between revisions
(New page: == Box == {{Template:Box|1: Text<br>2: color (silver)|silver}} == Note == {{Template:Note|1: Text<br>2: color (limegreen)|limegreen}} == Warning == {{Template:Warning|1:...) |
mNo edit summary |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Note|This page contains a list of official templates and explains how to use them}} | |||
=Usage= | |||
To use a template, type a code like this: | |||
<nowiki>{{Template:Name_of_the_template}}</nowiki> | |||
The keyword <code>Template:</code> is followed by the name of the template you want to use. Both have to be sorrounded by double braces. You can leave out the keyword, it's optional but makes the template usage more obvious. | |||
Templates may have placeholders where you can put your own text in. To fill these variables with content, extend the template code (see above) by a pipe characater <code>|</code> and enter whatever you want as content after it. The result for template with two placeholders could look like this: | |||
<nowiki>{{Name_of_the_template|An example|blue}}</nowiki> | |||
The first variable has now the text "An example" assigned. The second variable is set to "blue". I assumed that the template has two placeholders, one for a text and another for a color. The usage of the them depends on the template. | |||
== | =Creation= | ||
Templates are like all other wiki articles, but their names (article titles) start with <code>Template:</code><br> | |||
As you know, templates can contain placeholders while usual articles don't. Such a placeholder is simply an increasing number (starting at 1) in triple braces: | |||
{{Template: | <nowiki>{{{1}}}</nowiki> | ||
If you don't asign anything to a placeholder it will literally show up like this, unless it has a default value. In other words: If nothing is specified for the variable it will use this 'default content'. The placeholder code from above needs an enhancement to define such a default: | |||
<nowiki>{{{1|This will show up if nothing was specified for the first placeholder.}}}</nowiki> | |||
It's again a pipe character followed by the default content. Note that placeholders work really good for CSS formatting too: | |||
<nowiki><span style="color:{{{2|white}}}">{{{1}}}</span></nowiki> | |||
=Available templates= | |||
== Box == | |||
{{Template:Box|1: Text<br>2: color (silver, default: white)|silver}} | |||
== Note == | |||
{{Template:Note|1: Text<br>2: color (limegreen, default: white)|limegreen}} | |||
== Hint == | |||
{{Template:Hint|1: Text<br>2: color (yellow, default: white)|yellow}} | |||
== Info == | |||
{{Template:Info|1: Info text}} | |||
== Key == | |||
{{Template:Key|Alt+F5}} | |||
1: Keyboard / mouse combination (Alt+F5) | |||
== Color == | |||
{{Template:Color|1: Text<br>2: color (lightblue, default: white)|lightblue}} | |||
== Download == | |||
{{Template:Download|http://rgnwiki.com/}} | |||
1: URL (<nowiki>http://rgnwiki.com/</nowiki>)<br> | |||
2: Link label (default: DOWNLOAD)<br> | |||
3: Optional text between download icon and link (default: ''empty'') | |||
== Noob_approved == | |||
{{Template:Noob_approved}} | |||
<br style="clear:both;"> | |||
== Warning == | |||
{{Template:Warning|1: Text<br>2: color (orange, default: white)|orange}} | |||
== | == Warning_advanced == | ||
{{Template:Warning_advanced}} | {{Template:Warning_advanced}} | ||
<br style="clear:both;"> | <br style="clear:both;"> | ||
== Warning_forpro == | |||
{{Template:Warning_forpro}} | |||
''by [[User:CoDEmanX|CoDEmanX]]'' | |||
[[Category:Help]] |
Latest revision as of 08:18, 16 July 2009
Usage
To use a template, type a code like this:
{{Template:Name_of_the_template}}
The keyword Template:
is followed by the name of the template you want to use. Both have to be sorrounded by double braces. You can leave out the keyword, it's optional but makes the template usage more obvious.
Templates may have placeholders where you can put your own text in. To fill these variables with content, extend the template code (see above) by a pipe characater |
and enter whatever you want as content after it. The result for template with two placeholders could look like this:
{{Name_of_the_template|An example|blue}}
The first variable has now the text "An example" assigned. The second variable is set to "blue". I assumed that the template has two placeholders, one for a text and another for a color. The usage of the them depends on the template.
Creation
Templates are like all other wiki articles, but their names (article titles) start with Template:
As you know, templates can contain placeholders while usual articles don't. Such a placeholder is simply an increasing number (starting at 1) in triple braces:
{{{1}}}
If you don't asign anything to a placeholder it will literally show up like this, unless it has a default value. In other words: If nothing is specified for the variable it will use this 'default content'. The placeholder code from above needs an enhancement to define such a default:
{{{1|This will show up if nothing was specified for the first placeholder.}}}
It's again a pipe character followed by the default content. Note that placeholders work really good for CSS formatting too:
<span style="color:{{{2|white}}}">{{{1}}}</span>
Available templates
Box
2: color (silver, default: white)
Note
Hint
Info
Key
[Alt+F5]
1: Keyboard / mouse combination (Alt+F5)
Color
1: Text
2: color (lightblue, default: white)
Download
1: URL (http://rgnwiki.com/)
2: Link label (default: DOWNLOAD)
3: Optional text between download icon and link (default: empty)
Noob_approved
Warning
2: color (orange, default: white)
Warning_advanced
Warning_forpro
by CoDEmanX