Vorlage:Namespace detect: Unterschied zwischen den Versionen
Vorlage:Namespace detect (Quelltext anzeigen)
Version vom 13. November 2009, 04:03 Uhr
, vor 16 JahrenAdding the "page" parameter, so this template can work together with {{basepage subpage}} and {{if pagename}} etc. And using more efficient main (article) space detection.
imported>Davidgothberg (Changed to also understand "file=File page text" and "demospace=file". To handle the announced change from "Image" to "File" naming of that namespace.) |
imported>Davidgothberg (Adding the "page" parameter, so this template can work together with {{basepage subpage}} and {{if pagename}} etc. And using more efficient main (article) space detection.) |
||
| Zeile 4: | Zeile 4: | ||
{{#if:{{{demospace|}}} | {{#if:{{{demospace|}}} | ||
| {{{demospace}}} | | {{{demospace}}} | ||
| {{# | | {{#if:{{{page|}}} | ||
| | | <!--Detect the namespace in the "page" parameter--> | ||
{{#ifeq:{{NAMESPACE:{{{page}}} }}|{{TALKSPACE:{{{page}}} }} | |||
| talk | | talk | ||
| {{ | | {{SUBJECTSPACE:{{{page}}} }} | ||
}} | }} | ||
}} | | <!--No "demospace" or "page" parameters, so detect actual namespace--> | ||
{{#ifeq:{{NAMESPACE}}|{{TALKSPACE}} | |||
| talk | |||
| {{SUBJECTSPACE}} | |||
}} | |||
}} | |||
}} | }} | ||
}} | }} | ||
<!-- Only one of the lines below will be executed --> | <!-- Only one of the lines below will be executed --> | ||
<!-- Respecting empty parameters on purpose --> | <!-- Respecting empty parameters on purpose --> | ||
| main | | main <!--"demospace=main" or {{SUBJECTSPACE}}={{ns:0}}=""--> | ||
| = {{{main| {{{other|}}} }}} | |||
| talk = {{{talk| {{{other|}}} }}} | | talk = {{{talk| {{{other|}}} }}} | ||
| user = {{{user| {{{other|}}} }}} | | user = {{{user| {{{other|}}} }}} | ||
| Zeile 31: | Zeile 37: | ||
}}<!--End switch--><noinclude> | }}<!--End switch--><noinclude> | ||
{{pp-template | {{pp-template}} | ||
{{documentation}} | {{documentation}} | ||
<!-- Add categories and interwikis to the /doc subpage, not here! --> | <!-- Add categories and interwikis to the /doc subpage, not here! --> | ||
</noinclude> | </noinclude> | ||