Help:Templates: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:Note|This page contains a list of official templates and explains how to use them}}
{{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:
To use a template, type a code like this:


  <nowiki>{{Template:Name_of_the_template}}</nowiki>
  <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.
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:
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>{{Template:Name_of_the_template|An example|blue}}</nowiki>
  <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.
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 name starts with <code>Template:</code><br>
Templates are like all other wiki articles, but their name starts with <code>Template:</code><br>
As you know, templates can contain placeholders while usual articles don't. They look like this:
As you know, templates can contain placeholders while usual articles don't. It's basically an increasing number (starting at 1) in triple braces:


  <nowiki>{{{1}}}</nowiki>
  <nowiki>{{{1}}}</nowiki>


It's basically an increasing number (starting at 1) in triple braces. If you don't asign anything to a placeholder it will show up like this, unless it has a default value. 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:
 
If you don't asign anything to a placeholder it will show up like this, unless it has a default value. 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>
  <nowiki>{{{1|This will show up if nothing was specified for the first placeholder.}}}</nowiki>
Line 25: Line 29:
It's again a pipe character followed by the default content.
It's again a pipe character followed by the default content.


=Available templates=


== Box ==
== Box ==
Line 34: Line 40:


{{Template:Note|1: Text<br>2: color (limegreen)|limegreen}}
{{Template:Note|1: Text<br>2: color (limegreen)|limegreen}}
== Noob_approved ==
{{Template:Noob_approved}}
<br style="clear:both;">




Line 39: Line 50:


{{Template:Warning|1: Text<br>2: color (orange)|orange}}
{{Template:Warning|1: Text<br>2: color (orange)|orange}}
== Warning_advanced ==
{{Template:Warning_advanced}}
<br style="clear:both;">




Line 46: Line 63:




== Warning_advanced ==
''by [[User:CoDEmanX|CoDEmanX]]''
 
{{Template:Warning_advanced}}
<br style="clear:both;">


[[Category:Help]]
[[Category:Help]]

Revision as of 03:12, 14 April 2009

This page contains a list of official templates and explains how to use them

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 name starts with Template:
As you know, templates can contain placeholders while usual articles don't. It's basically an increasing number (starting at 1) in triple braces:

{{{1}}}


If you don't asign anything to a placeholder it will show up like this, unless it has a default value. 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.


Available templates

Box

1: Text
2: color (silver)


Note

1: Text
2: color (limegreen)


Noob_approved



Warning

1: Text
2: color (orange)


Warning_advanced



Warning_forpro

This tutorial assumes that you already know how to create, compile & create GSCs,CSVs & FastFiles for your maps


by CoDEmanX