Template:Namespace detect

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
(New page: {{#switch: {{lc: <!--Lower case the result--> <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{{demospace}}} | ...)
 
Line 4: Line 4:
     {{#if:{{{demospace|}}}  
     {{#if:{{{demospace|}}}  
     | {{{demospace}}}
     | {{{demospace}}}
-
     | {{#ifeq:{{NAMESPACE}}|{{ns:0}}
+
     | {{#if:{{{page|}}}  
-
       | main
+
       | <!--Detect the namespace in the "page" parameter-->
-
      | {{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}
+
        {{#ifeq:{{NAMESPACE:{{{page}}} }}|{{TALKSPACE:{{{page}}} }}
         | talk
         | talk
-
         | {{NAMESPACE}}  
+
         | {{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| {{{other|}}} }}}
+
| main       <!--"demospace=main" or {{SUBJECTSPACE}}={{ns:0}}=""-->
 +
|          = {{{main| {{{other|}}} }}}
| talk      = {{{talk| {{{other|}}} }}}
| talk      = {{{talk| {{{other|}}} }}}
| user      = {{{user| {{{other|}}} }}}
| user      = {{{user| {{{other|}}} }}}
Line 26: Line 32:
| category  = {{{category| {{{other|}}} }}}
| category  = {{{category| {{{other|}}} }}}
| portal    = {{{portal| {{{other|}}} }}}
| portal    = {{{portal| {{{other|}}} }}}
 +
| book      = {{{book| {{{other|}}} }}}
| other
| other
| #default  = {{{other|}}}  <!--"demospace=other" or a new namespace-->
| #default  = {{{other|}}}  <!--"demospace=other" or a new namespace-->
Line 31: Line 38:
}}<!--End switch--><noinclude>
}}<!--End switch--><noinclude>
-
{{pp-template|small=yes}}
+
{{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>

Latest revision as of 12:58, 2 August 2010

[create] 50px Template documentation
Personal tools