Difference between revisions of "Template talk:InfoBoxJumpShip"
(questions) |
(template example) |
||
Line 1: | Line 1: | ||
*Thanks for the cleanup, Nic. Gonna get into the code and see how you made it simpler. Now, statements like <nowiki>{{{Introduced|}}}</nowiki> don't refer to a template somewhere else, right? This is the only template needed for this infobox?--[[User:Revanche|Revanche]] 00:30, 10 October 2006 (CDT) | *Thanks for the cleanup, Nic. Gonna get into the code and see how you made it simpler. Now, statements like <nowiki>{{{Introduced|}}}</nowiki> don't refer to a template somewhere else, right? This is the only template needed for this infobox?--[[User:Revanche|Revanche]] 00:30, 10 October 2006 (CDT) | ||
+ | |||
+ | Correct. There's two things to remember about the templates. Two curlies <nowiki>{{ T }}</nowiki> in page A '''calls''' a template 'T', while three curlies in 'T' (such as the code <nowiki>{{{ Z }}}</nowiki>) '''refers to a parameter named Z''' that was passed from A to T. | ||
+ | |||
+ | '''Example 1''' | ||
+ | |||
+ | Lets say in page A, you want to call template T: | ||
+ | |||
+ | ''A code'': | ||
+ | <nowiki>{{ T | Param1=1 | Param2=2 }}</nowiki> | ||
+ | ''Template:T code:'' | ||
+ | First parameter = <nowiki>{{{Param1}}}</nowiki>, second = <nowiki>{{{Param2}}}</nowiki> | ||
+ | ''End Result/Output of A:'' | ||
+ | First parameter = 1, second = 2 | ||
+ | |||
+ | '''Example 2''' | ||
+ | |||
+ | The text after a pipe | operator after a parameter in a template designates its default value. Thus, if this was T: | ||
+ | |||
+ | ''A code'': | ||
+ | <nowiki>{{ T | Param1=1}}</nowiki> | ||
+ | ''Template:T code:'' | ||
+ | First parameter = <nowiki>{{{Param1}}}</nowiki>, second = <nowiki>{{{MissingParam2|default}}}</nowiki> | ||
+ | ''End Result/Output of A:'' | ||
+ | First parameter = 1, second = default | ||
+ | [[User:Nicjansma|Nicjansma]] 01:19, 10 October 2006 (CDT) |
Latest revision as of 02:19, 10 October 2006
- Thanks for the cleanup, Nic. Gonna get into the code and see how you made it simpler. Now, statements like {{{Introduced|}}} don't refer to a template somewhere else, right? This is the only template needed for this infobox?--Revanche 00:30, 10 October 2006 (CDT)
Correct. There's two things to remember about the templates. Two curlies {{ T }} in page A calls a template 'T', while three curlies in 'T' (such as the code {{{ Z }}}) refers to a parameter named Z that was passed from A to T.
Example 1
Lets say in page A, you want to call template T:
A code:
{{ T | Param1=1 | Param2=2 }}
Template:T code:
First parameter = {{{Param1}}}, second = {{{Param2}}}
End Result/Output of A:
First parameter = 1, second = 2
Example 2
The text after a pipe | operator after a parameter in a template designates its default value. Thus, if this was T:
A code:
{{ T | Param1=1}}
Template:T code:
First parameter = {{{Param1}}}, second = {{{MissingParam2|default}}}
End Result/Output of A:
First parameter = 1, second = default
Nicjansma 01:19, 10 October 2006 (CDT)