Changes

359 bytes added ,  10:23, October 25, 2010
no edit summary
Line 1: Line 1:  
Using templates can be easy or hard, depending on the template.  But normally they are easy.
 
Using templates can be easy or hard, depending on the template.  But normally they are easy.
   −
<div style="background-color:#dff; border:solid 1px blue; padding:5px; float:right; width:20em; margin-left:5px"><small><small>{{mainpageright}}</small></small></div>
+
<div style="background-color:#dff; border:solid 1px blue; padding:5px; float:right; width:20em; margin-left:5px"><small><small><nowiki>{{mainpageright}}</nowiki></small></small></div>
 
__TOC__
 
__TOC__
−
<big>'''Before you can attach your own template to any CP page, you will need to submit it for approval at [[Template Submission]].'''</big>
      
== Basic instructions ==
 
== Basic instructions ==
Line 20: Line 19:     
For example, the ''Welcome'' template that someone might have put on your user talk page has two parameters.  One is the name of the user, and the other is the name of the person placing the welcome message.  See the example below welcoming The Joker, placed by Batman:
 
For example, the ''Welcome'' template that someone might have put on your user talk page has two parameters.  One is the name of the user, and the other is the name of the person placing the welcome message.  See the example below welcoming The Joker, placed by Batman:
−
<div style="width:65%"><small><small>{{welcome|Joker|sig=from Batman}}</small></small></div>
+
<nowiki><div style="width:65%"><small><small>{{welcome|Joker|sig=from Batman}}</small></small></div></nowiki>
    
(This was included on this page by typing {{tt|<nowiki>{{welcome|Joker|sig=from Batman}}</nowiki>}}.<ref name="shrunk" />)
 
(This was included on this page by typing {{tt|<nowiki>{{welcome|Joker|sig=from Batman}}</nowiki>}}.<ref name="shrunk" />)
Line 27: Line 26:     
Parameters can be optional or required, and they can be named or not named.  In the example above, the first parameter ("Joker") was not named, but the second ("from Batman") was named ''sig''.  Two points need to be kept in mind with parameters:
 
Parameters can be optional or required, and they can be named or not named.  In the example above, the first parameter ("Joker") was not named, but the second ("from Batman") was named ''sig''.  Two points need to be kept in mind with parameters:
−
* Named parameters can be supplied in any order.
+
* '''Named parameters''' can be supplied in any order.
−
* Un-named parameters must be supplied in the correct order.
+
* '''Un-named parameters''' must be supplied in the correct order.
 +
See below for how parameters are provided to templates.
 +
 
 
Each template has (or will have) a list of parameters, looking something like this (this one is from the {{tl|welcome}} template):
 
Each template has (or will have) a list of parameters, looking something like this (this one is from the {{tl|welcome}} template):
 
{{Parms|
 
{{Parms|
Line 41: Line 42:  
You can assume that if no default is shown for a parameter that is not required, the result will be blank (i.e. in this case, the welcome message would not show who it was from).
 
You can assume that if no default is shown for a parameter that is not required, the result will be blank (i.e. in this case, the welcome message would not show who it was from).
   −
You will notice that named parameters have the parameter name followed by an equals sign (=) followed by whatever you want that to be.
+
To supply a value to a '''named parameter''', put the parameter name followed by an equals sign (=) followed by whatever you want that to be.  In the example above, this is {{tt|<nowiki>sig=~~~~</nowiki>}}.
 +
 
 +
Parameters shown with numbers are the '''un-named parameters'''.  You ''can'' treat them as named parameters, by typing {{tt|1=1=''your text''}}, but this is not necessary, except in the case that you want your text to include an equals sign (=).  Normally you just supply the value, such as {{tt|YourUserName}}.
 +
 
 +
Each parameter is separated from each other, and from the template name, by a 'pipe' character: {{tt|{{!}}}}.
   −
Parameters shown with numbers are the un-named parameters.  You ''can'' treat them as named parameters, by typing {{tt|1=1=''your text''}}, but this is not necessary, except in the case that you want your text to include an equals sign (=).
+
So supplying both parameters in the {{tl|welcome}} template would look like this: {{tt|<nowiki>{{welcome|YourUserName|sig=~~~~}}</nowiki>}}.
    
=== What do you pass to parameters? ===
 
=== What do you pass to parameters? ===
nsTeam1RO, nsTeam1RW, nsTeam1_talkRO, nsTeam1_talkRW
26,487

edits