「ヘルプ:Templates」を編集中
この編集を取り消せます。
下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 | 編集中の文章 | ||
50行目: | 50行目: | ||
<translate> | <translate> | ||
<!--T:16--> | <!--T:16--> | ||
− | * <code><nowiki>{{subst:Name}}</nowiki></code> — when this template link is used, it will be replaced once and for all with the content of <nowiki>[[Template:Name]]</nowiki> as of the time the page with the link is '''saved''': a copy of the contents of <nowiki>[[Template:Name]]</nowiki> will be ''substituted'' for the template link. The contents are then a part of the including page, and can be edited normally, separately from the original. ''Note'': | + | * <code><nowiki>{{subst:Name}}</nowiki></code> — when this template link is used, it will be replaced once and for all with the content of <nowiki>[[Template:Name]]</nowiki> as of the time the page with the link is '''saved''': a copy of the contents of <nowiki>[[Template:Name]]</nowiki> will be ''substituted'' for the template link. The contents are then a part of the including page, and can be edited normally, separately from the original. ''Note'': changes to the source template page will ''not'' be propagated to the page with the template link. |
</translate> | </translate> | ||
<translate> | <translate> | ||
100行目: | 100行目: | ||
<!--T:31--> | <!--T:31--> | ||
So that the note will look similar everywhere it is used, you can define a template called [[Template:Thankyou]], for example. Although the note should look similar whenever a user thanks another user, its specific contents (i.e. the reason and the signature) will be different. For that reason, you should pass them as parameters. If we ignore the remaining elements to format the box and place the image, the core content of the template will be this: | So that the note will look similar everywhere it is used, you can define a template called [[Template:Thankyou]], for example. Although the note should look similar whenever a user thanks another user, its specific contents (i.e. the reason and the signature) will be different. For that reason, you should pass them as parameters. If we ignore the remaining elements to format the box and place the image, the core content of the template will be this: | ||
− | |||
− | + | <!--T:32--> | |
− | + | <pre><nowiki>'''A little thank you...''' | |
− | '''A little thank you...''' | ||
for {{{1}}}. | for {{{1}}}. | ||
− | hugs, {{{2}}}</ | + | hugs, {{{2}}}</nowiki></pre> |
− | </ | ||
− | |||
<!--T:33--> | <!--T:33--> | ||
Notice the use of <tvar|1><code><nowiki>{{{1}}}</nowiki></code></> and <tvar|2><code><nowiki>{{{2}}}</nowiki></code></>. This is the way to identify, within templates, the parameters that will be passed in when the template is used. Note that, within the template, each parameter is surrounded by '''three''' braces: <tvar|braces><code><nowiki>{{{ }}}</nowiki></code></>. This is different from normal template name usage. | Notice the use of <tvar|1><code><nowiki>{{{1}}}</nowiki></code></> and <tvar|2><code><nowiki>{{{2}}}</nowiki></code></>. This is the way to identify, within templates, the parameters that will be passed in when the template is used. Note that, within the template, each parameter is surrounded by '''three''' braces: <tvar|braces><code><nowiki>{{{ }}}</nowiki></code></>. This is different from normal template name usage. | ||
205行目: | 201行目: | ||
<!--T:61--> | <!--T:61--> | ||
Since no parameters were passed in, the template presents the parameters themselves, instead of their respective values. In these cases, it may be useful to define ''default'' values for the parameters, i.e. values that will be used if no value is passed in. For example, if the template contents are changed to: | Since no parameters were passed in, the template presents the parameters themselves, instead of their respective values. In these cases, it may be useful to define ''default'' values for the parameters, i.e. values that will be used if no value is passed in. For example, if the template contents are changed to: | ||
− | |||
− | + | <!--T:62--> | |
− | + | <pre><nowiki>'''A little thank you...''' | |
− | '''A little thank you...''' | ||
for {{{reason|everything}}}. | for {{{reason|everything}}}. | ||
− | hugs, {{{signature|Me}}}</ | + | hugs, {{{signature|Me}}}</nowiki></pre> |
− | </ | ||
− | |||
<!--T:63--> | <!--T:63--> | ||
then <code><nowiki>{{{reason|everything}}}</nowiki></code> defines that if no parameter <code>{{{reason}}}</code> is provided, then the value <code>everything</code> will be used. Similarly, <code><nowiki>{{{signature|Me}}}</nowiki></code>, defaults parameter <code>{{{signature}}}</code> to value <code>Me</code>. Now, transcluding the template again without passing any parameter, results in the following: | then <code><nowiki>{{{reason|everything}}}</nowiki></code> defines that if no parameter <code>{{{reason}}}</code> is provided, then the value <code>everything</code> will be used. Similarly, <code><nowiki>{{{signature|Me}}}</nowiki></code>, defaults parameter <code>{{{signature}}}</code> to value <code>Me</code>. Now, transcluding the template again without passing any parameter, results in the following: | ||
220行目: | 212行目: | ||
<!-- strictly speaking, this example is false, because the template call was changed to obtain the desired effect - but the effect is the same if the template is defined as described --> | <!-- strictly speaking, this example is false, because the template call was changed to obtain the desired effect - but the effect is the same if the template is defined as described --> | ||
<translate> | <translate> | ||
− | <!--T: | + | <!--T:64--> |
{{Thankyou|reason=everything|signature=Me}} | {{Thankyou|reason=everything|signature=Me}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Control template inclusion == <!--T:65--> | == Control template inclusion == <!--T:65--> | ||
306行目: | 245行目: | ||
<!--T:74--> | <!--T:74--> | ||
− | Everything outside <tvar|noinclude><code><nowiki><noinclude></nowiki></code></> and <tvar|includeonly><code><nowiki><includeonly></nowiki></code></> is processed and displayed normally; that is, both when the template page is being viewed directly and when the template is included in another page | + | Everything outside <tvar|noinclude><code><nowiki><noinclude></nowiki></code></> and <tvar|includeonly><code><nowiki><includeonly></nowiki></code></> tags is processed and displayed normally; that is, both when the template page is being viewed directly and when the template is included in another page. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Organizing templates == <!--T:75--> | == Organizing templates == <!--T:75--> | ||
349行目: | 270行目: | ||
<!--T:80--> | <!--T:80--> | ||
Then, an editor can simply copy and paste the example to use the template. | Then, an editor can simply copy and paste the example to use the template. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Copying from one wiki to another == <!--T:81--> | == Copying from one wiki to another == <!--T:81--> | ||
413行目: | 320行目: | ||
<!--T:118--> | <!--T:118--> | ||
− | After | + | After sucessfully importing the template and all its linked templates from the other wiki, edit it to change customisations to suit your wiki. For example to change a logo, remove redundant categories or red links. |
=== Extensions === <!--T:100--> | === Extensions === <!--T:100--> | ||
437行目: | 344行目: | ||
<!--T:124--> | <!--T:124--> | ||
− | + | Experiment shows that if you include a template in itself, it won't put MediaWiki into an infinite recursion.</translate> | |
<translate> | <translate> | ||
<!--T:125--> | <!--T:125--> | ||
470行目: | 377行目: | ||
* [[<tvar|meta>m:Help:Embed page</>|m:Help:Embed page]] – embedding pages from [[<tvar|ns>Special:MyLanguage/Help:Namespaces</>|namespaces]] other than <code>Template:</code>. | * [[<tvar|meta>m:Help:Embed page</>|m:Help:Embed page]] – embedding pages from [[<tvar|ns>Special:MyLanguage/Help:Namespaces</>|namespaces]] other than <code>Template:</code>. | ||
</translate> | </translate> | ||
− | * | + | <translate> |
+ | <!--T:119--> | ||
+ | * [[Manual:Importing Wikipedia infoboxes tutorial|Importing Wikipedia infoboxes tutorial]] | ||
+ | </translate> | ||
[[Category:Help{{translation}}|Templates]] | [[Category:Help{{translation}}|Templates]] | ||
[[Category:Template{{translation}}]] | [[Category:Template{{translation}}]] | ||
[[Category:MediaWiki for site admins{{translation}}]] | [[Category:MediaWiki for site admins{{translation}}]] |