Template:Namespace: Difference between revisions

Jump to navigation Jump to search
replaced "empty" with more flexible "others", doc to reflect the change
(new metatemplate)
 
(replaced "empty" with more flexible "others", doc to reflect the change)
 
Line 1: Line 1:
<includeonly>{{#switch: {{NAMESPACENUMBER:{{{page|{{FULLPAGENAME}}}}}}}
<includeonly>{{#switch: {{NAMESPACENUMBER:{{{page|{{FULLPAGENAME}}}}}}}
   | 0 = {{{main|{{#ifeq: {{{empty|}}}|yes| |article}}}}}
   | 0 = {{{main|{{{others|article}}}}}}
   | 1 = {{{talk|{{#ifeq: {{{empty|}}}|yes| |talk page}}}}}
   | 1 = {{{talk|{{{others|talk page}}}}}}
   | 2 = {{{user|{{#ifeq: {{{empty|}}}|yes| |user page}}}}}
   | 2 = {{{user|{{{others|user page}}}}}}
   | 3 = {{{user talk|{{#ifeq: {{{empty|}}}|yes| |user talk page}}}}}
   | 3 = {{{user talk|{{{others|user talk page}}}}}}
   | 4 = {{{118wiki|{{#ifeq: {{{empty|}}}|yes| |project page}}}}}
   | 4 = {{{118wiki|{{{others|project page}}}}}}
   | 5 = {{{118wiki talk|{{#ifeq: {{{empty|}}}|yes| |project talk page}}}}}
   | 5 = {{{118wiki talk|{{{others|project talk page}}}}}}
   | 6 = {{{file|{{#ifeq: {{{empty|}}}|yes| |file}}}}}
   | 6 = {{{file|{{{others|file}}}}}}
   | 7 = {{{file talk|{{#ifeq: {{{empty|}}}|yes| |file talk page}}}}}
   | 7 = {{{file talk|{{{others|file talk page}}}}}}
   | 8 = {{{mediawiki|{{#ifeq: {{{empty|}}}|yes| |MediaWiki system page}}}}}
   | 8 = {{{mediawiki|{{{others|MediaWiki system page}}}}}}
   | 9 = {{{mediawiki talk|{{#ifeq: {{{empty|}}}|yes| |MediaWiki system talk page}}}}}
   | 9 = {{{mediawiki talk|{{{others|MediaWiki system talk page}}}}}}
   | 10 = {{{template|{{#ifeq: {{{empty|}}}|yes| |template}}}}}
   | 10 = {{{template|{{{others|template}}}}}}
   | 11 = {{{template talk|{{#ifeq: {{{empty|}}}|yes| |template talk page}}}}}
   | 11 = {{{template talk|{{{others|template talk page}}}}}}
   | 12 = {{{help|{{#ifeq: {{{empty|}}}|yes| |help page}}}}}
   | 12 = {{{help|{{{others|help page}}}}}}
   | 13 = {{{help talk|{{#ifeq: {{{empty|}}}|yes| |help talk page}}}}}
   | 13 = {{{help talk|{{{others|help talk page}}}}}}
   | 14 = {{{category|{{#ifeq: {{{empty|}}}|yes| |category}}}}}
   | 14 = {{{category|{{{others|category}}}}}}
   | 15 = {{{category talk|{{#ifeq: {{{empty|}}}|yes| |category talk page}}}}}
   | 15 = {{{category talk|{{{others|category talk page}}}}}}
   | 1280 = {{{sim|{{#ifeq: {{{empty|}}}|yes| |sim}}}}}
   | 1280 = {{{sim|{{{others|sim}}}}}}
   | 1281 = {{{sim talk|{{#ifeq: {{{empty|}}}|yes| |sim talk page}}}}}
   | 1281 = {{{sim talk|{{{others|sim talk page}}}}}}
   | page
   | page
}}</includeonly><noinclude>
}}</includeonly><noinclude>
Line 30: Line 30:


Full usage:
Full usage:
<pre>{{Namespace|page= |empty= |main= |talk= |user= |user talk= |118wiki= |118wiki talk= |file= |file talk= |mediawiki= |mediawiki talk= |template= |template talk= |help= |help talk= |category= |category talk= |sim= |sim talk= }}</pre>
<pre>{{Namespace|page= |others= |main= |talk= |user= |user talk= |118wiki= |118wiki talk= |file= |file talk= |mediawiki= |mediawiki talk= |template= |template talk= |help= |help talk= |category= |category talk= |sim= |sim talk= }}</pre>


At basic use, the template will print a reader-friendly name for the namespace of the page the template is placed in.
At basic use, the template will print a reader-friendly name for the namespace of the page the template is placed in.
Line 80: Line 80:
'''page''' parameter can be used to determine from which page the namespace is taken. If left empty, takes the namespace of the current page. Note that this parameter doesn't check if the page actually exists!
'''page''' parameter can be used to determine from which page the namespace is taken. If left empty, takes the namespace of the current page. Note that this parameter doesn't check if the page actually exists!


'''empty''' parameter empties all predefined namespace dependent values, in which case the template doesn't return anything on pages in namespaces for which you haven't defined a new value. Write "yes" if you don't want to use the predefined values.
'''others''' parameter determines the content displayed on every namespace except those that have a custom text. If left empty, the nothing will appear on pages in namespace other than those defined.


== Examples ==
== Examples ==
Line 110: Line 110:
Note that if you place this template to a page other than article, file or template, it will print the namespace name as usual. For example, on a talk page, this is what you would get:
Note that if you place this template to a page other than article, file or template, it will print the namespace name as usual. For example, on a talk page, this is what you would get:
{{Ambox | type=notice | text={{namespace|main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.|file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".|template=Templates can only be edited with the source editor.|page=Talk:Example}}}}
{{Ambox | type=notice | text={{namespace|main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.|file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".|template=Templates can only be edited with the source editor.|page=Talk:Example}}}}
If this is not something you want, empty all other values with parameter "empty":
If this is not something you want, empty all other values with parameter "others":
<pre>{{Ambox  
<pre>{{Ambox  
| type=notice  
| type=notice  
| text='''{{namespace
| text='''{{namespace
   |empty=yes
   |others=
   |main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.
   |main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.
   |file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".
   |file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".
Line 120: Line 120:
}}</pre>
}}</pre>
Now, you get:
Now, you get:
{{Ambox | type=notice | text={{namespace|empty=yes|main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.|file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".|template=Templates can only be edited with the source editor.}}}}
{{Ambox | type=notice | text={{namespace|others=|main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.|file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".|template=Templates can only be edited with the source editor.}}}}
And on a talk page:
And on a talk page:
{{Ambox | type=notice | text={{namespace|empty=yes|main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.|file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".|template=Templates can only be edited with the source editor.|page=Talk:Example}}}}
{{Ambox | type=notice | text={{namespace|others=|main=You can edit articles like this one by clicking "edit" or "edit source" on top of the page.|file=You can upload a new version of this file by clicking "Upload a new version of this file". To edit the file information page, click "edit" or "edit source".|template=Templates can only be edited with the source editor.|page=Talk:Example}}}}


The custom value can also be formatted, another template, category or something else.
The custom value can also be formatted, another template, category or something else.
1,769

edits

Navigation menu