Vorlage:Namespace detect/Doku: Unterschied zwischen den Versionen
Vorlage:Namespace detect/Doku (Quelltext anzeigen)
Version vom 13. November 2009, 05:26 Uhr
, vor 16 JahrenDocumenting the new "page" parameter.
imported>Davidgothberg (→See also: Adding or fixing interwiki to Mongolian Wikipedia.) |
imported>Davidgothberg (Documenting the new "page" parameter.) |
||
| Zeile 80: | Zeile 80: | ||
}} | }} | ||
=== | === The "demospace" and "page" parameters === | ||
For testing and demonstration purposes this template can take | For testing and demonstration purposes this template can take two parameters named '''demospace''' and '''page'''. | ||
Demospace understands any of the page type names used by this template, including the '''other''' type. It tells the template to behave like it is on some specific type of page. Like this: | |||
<pre> | <pre> | ||
| Zeile 100: | Zeile 102: | ||
}} | }} | ||
It can be convenient to let your template understand the demospace parameter and send it on to the {{tl|namespace detect}} template. Then do like this: | The '''page''' parameter instead takes a normal pagename. It makes this template behave exactly as if on that page. The pagename doesn't have to be an existing page. Like this: | ||
<pre> | |||
{{namespace detect | |||
| user = User page text | |||
| other = Other pages text | |||
| page = User:Example | |||
}} | |||
</pre> | |||
No matter on what kind of page the code above is used it will return this: | |||
:{{namespace detect | |||
| user = User page text | |||
| other = Other pages text | |||
| page = User:Example | |||
}} | |||
It can be convenient to let your template understand the demospace and/or page parameter and send it on to the {{tl|namespace detect}} template. Then do like this: | |||
<pre> | <pre> | ||
| Zeile 107: | Zeile 127: | ||
| other = Other pages text | | other = Other pages text | ||
| demospace = {{{demospace|}}} | | demospace = {{{demospace|}}} | ||
| page = {{{page|}}} | |||
}} | }} | ||
</pre> | </pre> | ||
If the '''demospace''' | If both the '''demospace''' and '''page''' parameters are empty or undefined then the template will detect page types as usual. | ||
=== Parameters === | === Parameters === | ||
| Zeile 124: | Zeile 145: | ||
wikipedia / file / mediawiki / template / | wikipedia / file / mediawiki / template / | ||
help / category / portal / other | help / category / portal / other | ||
| page = {{{page|}}} / User:Example | |||
}} | }} | ||
</pre> | </pre> | ||