Changes

Jump to navigation Jump to search
What do you pass to parameters?
Line 16: Line 16:  
However, many templates allow you to add to the information in the template, or to change it's appearance, by supplying ''parameters''.
 
However, many templates allow you to add to the information in the template, or to change it's appearance, by supplying ''parameters''.
   −
For example, the ''Welcome'' template that someone might have put on your user talk page has two parameters.  One is the name of 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:
 
{{welcome|Joker|sig=from Batman}}
 
{{welcome|Joker|sig=from Batman}}
   Line 42: Line 42:  
Parameters shown with numbers are the un-named parameters.  You ''can'' treat them as named parameters, by typing 1=''your text'', but this is not necessary, except in the case that you want your text to include an equals sign (=).
 
Parameters shown with numbers are the un-named parameters.  You ''can'' treat them as named parameters, by typing 1=''your text'', but this is not necessary, except in the case that you want your text to include an equals sign (=).
   −
You can set the parameter to be blank (although this should not normally be necessary) by typing nothing after the pipe character for an unnamed parameter, or nothing after the equals sign for a named parameter.  For example, if you wanted the welcome template to not show "Joker" or "from Batman", you could type <tt><small><nowiki>{{welcome||sig=}}</nowiki></small></tt> (although, as mentioned, leaving the ''sig'' parameter out altogether has the same effect).
+
=== What do you pass to parameters? ===
 +
 
 +
Obviously, you give a parameter the text that it expects, such as "from Batman" in the example above.  But in most cases, you can give a parameter any text that you like.  You could, for example, put "But break any laws and I'll bring the full weight of the law down on you, (signed) Batman"!
 +
 
 +
In some cases, however, specific text must be supplied.  The {{tl|Bible ref}} template, for example, expects a book of the Bible for the "book" parameter, and giving it something that is not a book of the Bible will break the link to BibleGateway that the template creates.
 +
 
 +
In many cases you can supply a blank value to the parameter.  You can set a parameter to be blank by typing nothing after the pipe character for an unnamed parameter, or nothing after the equals sign for a named parameter.  For example, if you wanted the welcome template to not show "Joker" or "from Batman", you could type <tt><small><nowiki>{{welcome||sig=}}</nowiki></small></tt>
 +
 
 +
However, a well-written template will allow you to simply omit the parameter altogether, as the {{tl|welcome}} template does with the ''sig'' parameter.
nsTeam2RO, nsTeam2RW, nsTeam2_talkRO, nsTeam2_talkRW
13,254

edits

Navigation menu