Changes

Jump to navigation Jump to search
→‎Parameters: Clarify parameter passing
Line 26: 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 40: 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 parameters''', 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? ===
nsTeam2RO, nsTeam2RW, nsTeam2_talkRO, nsTeam2_talkRW
13,254

edits

Navigation menu