Difference between revisions of "WB3000"
From WikiTemp, the GBAtemp wiki
(Created Page) |
(random template) |
||
Line 1: | Line 1: | ||
− | [[ | + | THISISAWORKING TEMPLATE!!! |
+ | |||
+ | {{PD Help Page}} | ||
+ | aa | ||
+ | |||
+ | ==Creating a template== | ||
+ | aaa | ||
+ | |||
+ | ==Using a template== | ||
+ | aaa | ||
+ | *<code><nowiki>{{Name}}</nowiki></code> 'transcludes' (i.e. includes a copy of) the content of the template (stored in the page <nowiki>[[Template:Name]]</nowiki>) aaa | ||
+ | *<code><nowiki>{{subst:Name}}</nowiki></code>aaa. '''''Note''''': aaa | ||
+ | *<code><nowiki>{{msgnw:Name}}</nowiki></code>aaa <code><nowiki><nowiki></nowiki></code> does) aaa | ||
+ | |||
+ | aaa | ||
+ | |||
+ | *<code><nowiki>{{Template:Pagename}}</nowiki></code> includes <code><nowiki>[[Template:Pagename]]</nowiki></code> | ||
+ | *<code><nowiki>{{Foo:Pagename}}</nowiki></code> includes <code><nowiki>[[Foo:Pagename]]</nowiki></code> | ||
+ | *<code><nowiki>{{:Pagename}}</nowiki></code> includes <code><nowiki>[[Pagename]]</nowiki></code> | ||
+ | |||
+ | bbbb | ||
+ | |||
+ | *<code><nowiki>{{Foo:Bar}}</nowiki></code> includes <code><nowiki>[[Template:Foo:Bar]]</nowiki></code> | ||
+ | |||
+ | ==Using parameters in templates== | ||
+ | <div style="float:right; margin:8px;"> | ||
+ | {| {{Prettytable}} | ||
+ | |- | ||
+ | |{{Hl2}} colspan="2" align="center" |'''Template with numbered parameters''' | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | <pre><nowiki> | ||
+ | ''bbb.'''<br> | ||
+ | <small>for {{{1}}}.<br> | ||
+ | hugs, {{{2}}}</small> | ||
+ | </nowiki></pre> | ||
+ | |- | ||
+ | |{{Hl2}}|'''bbbbb''' | ||
+ | |{{Hl2}}|'''bbbbbbb''' | ||
+ | |- | ||
+ | |<code><nowiki>{{aau|abbb|ace}}</nowiki></code> | ||
+ | | | ||
+ | {{aab|bbbba|s}} | ||
+ | |- | ||
+ | |{{Hl2}} colspan="2" align="center" |'''with named parameters''' | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | <pre><nowiki> | ||
+ | '''A little thank you...'''<br> | ||
+ | <small>for {{{reason}}}.<br> | ||
+ | hugs, {{{signature}}}</small> | ||
+ | </nowiki></pre> | ||
+ | |- | ||
+ | |{{Hl2}}|'''You type''' | ||
+ | |{{Hl2}}|'''You get''' | ||
+ | |- | ||
+ | |<pre><nowiki>{{Thankyou | ||
+ | |reason=all your hard work | ||
+ | |signature=Joe}}</nowiki></pre> | ||
+ | | | ||
+ | {{Thankyou|all your hard work|Joe}} | ||
+ | |} | ||
+ | </div> | ||
+ | <code><nowiki>{{{1}}}</nowiki></code> or named <code><nowiki>{{{param}}}</nowiki></code>. | ||
+ | |||
+ | '' | ||
+ | |||
+ | When using the tem | ||
+ | |||
+ | Yo <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>. | ||
+ | |||
+ | ==Control template inclusion== | ||
+ | You can control template inclusion by the use of <code><nowiki><noinclude></nowiki></code> and | ||
+ | <code><nowiki><includeonly></nowiki></code> tags. | ||
+ | |||
+ | Anything between <code><nowiki><noinclude></nowiki></code> and <code><nowiki></noinclude></nowiki></code> will be processed and | ||
+ | displayed only when the template's page is being viewed directly. | ||
+ | |||
+ | Possible applications are: | ||
+ | * Categorising templates | ||
+ | * Interlanguage links to similar templates in other languages | ||
+ | * Explanatory text about how to use the template | ||
+ | |||
+ | The converse is <code><nowiki><includeonly></nowiki></code>. Text between <code><nowiki><includeonly></nowiki></code> and <code><nowiki></includeonly></nowiki></code> will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a [[Help:Categories|category]], without putting the template itself into that category. | ||
+ | |||
+ | |||
+ | ==Organizing templates== | ||
+ | |||
+ | For example: | ||
+ | <div style="display:table; width:auto;"><pre> | ||
+ | <noinclude> | ||
+ | ==Usage== | ||
+ | Allows to establish a link to a subject: | ||
+ | <nowiki>{{NameOfTemplate|Term1+Term2+Term3}}</nowiki> | ||
+ | </noinclude> | ||
+ | </pre></div> | ||
+ | |||
+ | *[[Help:External searches]] -- a template special use case example | ||
+ | *[[Help:Magic words]] -- fancy stuff you may find in some templates | ||
+ | *{{mediawiki|meta:Help:Embed page}} -- embedding pages from {{mediawiki|namespace|namespaces}} other than <code>Template:</code>. | ||
+ | |||
+ | [[Category:Help|{{PAGENAME}}]] | ||
+ | [[Category:Template]] | ||
+ | {{Languages|Help:Templates}} |
Revision as of 03:03, 14 December 2008
THISISAWORKING TEMPLATE!!!
Contents
Creating a template
aaa
Using a template
aaa
{{Name}}
'transcludes' (i.e. includes a copy of) the content of the template (stored in the page [[Template:Name]]) aaa{{subst:Name}}
aaa. Note: aaa{{msgnw:Name}}
aaa<nowiki>
does) aaa
aaa
{{Template:Pagename}}
includes[[Template:Pagename]]
{{Foo:Pagename}}
includes[[Foo:Pagename]]
{{:Pagename}}
includes[[Pagename]]
bbbb
{{Foo:Bar}}
includes[[Template:Foo:Bar]]
Using parameters in templates
Template with numbered parameters | |
''bbb.'''<br> <small>for {{{1}}}.<br> hugs, {{{2}}}</small> | |
bbbbb | bbbbbbb |
{{aau|abbb|ace}}
|
|
with named parameters | |
'''A little thank you...'''<br> <small>for {{{reason}}}.<br> hugs, {{{signature}}}</small> | |
You type | You get |
{{Thankyou |reason=all your hard work |signature=Joe}} |
{{{1}}}
or named{{{param}}}
.
When using the tem
Yo {{{reason|all your hard work}}}
would result in "all your hard work" if no value was provided for the parameter reason.
Control template inclusion
You can control template inclusion by the use of <noinclude>
and
<includeonly>
tags.
Anything between <noinclude>
and </noinclude>
will be processed and
displayed only when the template's page is being viewed directly.
Possible applications are:
- Categorising templates
- Interlanguage links to similar templates in other languages
- Explanatory text about how to use the template
The converse is <includeonly>
. Text between <includeonly>
and </includeonly>
will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a category, without putting the template itself into that category.
Organizing templates
For example:
<noinclude> ==Usage== Allows to establish a link to a subject: {{NameOfTemplate|Term1+Term2+Term3}} </noinclude>
- Help:External searches -- a template special use case example
- Help:Magic words -- fancy stuff you may find in some templates
- Template:Mediawiki -- embedding pages from Template:Mediawiki other than
Template:
.Template:Languages