Help:Templates

Jump to: navigation, search
Line 38: Line 38:
 
|{{Hl2}}|'''You get'''
 
|{{Hl2}}|'''You get'''
 
|-
 
|-
|<code><nowiki>{{Thankyou|all your hard work|Joe}}</nowiki></code>
+
|<code><nowiki>{{Thankyou|all your hard work|Jon}}</nowiki></code>
 
|
 
|
{{Thankyou|all your hard work|Joe}}
+
{{Thankyou|all your hard work|Jon}}
 
|-
 
|-
 
|{{Hl2}} colspan="2" align="center" |'''with named parameters'''
 
|{{Hl2}} colspan="2" align="center" |'''with named parameters'''
Line 58: Line 58:
 
|signature=Jon}}</nowiki></pre>
 
|signature=Jon}}</nowiki></pre>
 
|
 
|
{{Thankyou|all your hard work|Joe}}
+
{{Thankyou|all your hard work|Jon}}
 
|}
 
|}
 
</div>
 
</div>
Line 65: Line 65:
 
'''Example:''' You want a little thank you note you can put on the talk page of other users. It will contain a reason and your signature. You could create [[Template:Thankyou]] to enter your text, as in the example in the table.
 
'''Example:''' You want a little thank you note you can put on the talk page of other users. It will contain a reason and your signature. You could create [[Template:Thankyou]] to enter your text, as in the example in the table.
  
When using the template on a page, you fill in the parameter values, separated by a pipe char (|): <code><nowiki>{{Thankyou|all your hard work|Jon}}</nowiki></code>.  For named parameters use "name=value" pairs separated by a pipe char:  <code><nowiki>{{Thankyou|reason=all your hard work|signature=Jon}}</nowiki></code>. The advantage of using named parameters in your template is that they are flexible in order. It also makes the template easier to understand if you have many parameters. If you want to change the order of numbered parameters, you have to mention them explicitly: <code><nowiki>{{Thankyou|2=Joe|1=all your hard work}}</nowiki></code>.
+
When using the template on a page, you fill in the parameter values, separated by a pipe char (|): <code><nowiki>{{Thankyou|all your hard work|Jon}}</nowiki></code>.  For named parameters use "name=value" pairs separated by a pipe char:  <code><nowiki>{{Thankyou|reason=all your hard work|signature=Jon}}</nowiki></code>. The advantage of using named parameters in your template is that they are flexible in order. It also makes the template easier to understand if you have many parameters. If you want to change the order of numbered parameters, you have to mention them explicitly: <code><nowiki>{{Thankyou|2=Jon|1=all your hard work}}</nowiki></code>.
  
 
You can also provide default values for parameters, i.e. values that are going to be used if no value is provided for a parameter. For example, <code><nowiki>{{{reason|all your hard work}}}</nowiki></code> would result in ''"all your hard work"'' if no value was provided for the parameter <tt>reason</tt>.
 
You can also provide default values for parameters, i.e. values that are going to be used if no value is provided for a parameter. For example, <code><nowiki>{{{reason|all your hard work}}}</nowiki></code> would result in ''"all your hard work"'' if no value was provided for the parameter <tt>reason</tt>.

Revision as of 18:58, 1 September 2009

Personal tools
Namespaces
Variants
Actions
Navigation
Categories
Toolbox