Home
Random
Log in
Settings
About the Petit Planet Wiki
Search
Editing
Template
:
Namespace/doc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation/Header}} {{High Risk}} {{Lua|Namespace detect}} The {{T|Namespace}} meta-template selectively displays content inside the relevant namespace based on the provided parameters. See [[w:Help:Namespace#What_are_the_basic_namespaces?|Help:Namespace]] for a list of namespaces and their descriptions. ==Parameters== * <code>main</code>: content in this parameter will only be displayed if this template is used on a page in the '''Main''' (i.e. article) space. * <code>talk</code>: content in this parameter will only be displayed if this template is used on a page in the '''Talk''' space, including page names that start with "Talk:", "User talk:", "File talk:", etc. * <code>user</code>: content in this parameter will only be displayed if this template is used on a page in the '''User''' space * <code>file</code>: content in this parameter will only be displayed if this template is used on a page in the '''File''' space ** For backwards compatibility, this template handles '''image''' as if '''file'''. '''image''' (<nowiki>[[Image:...]]</nowiki>) is now deprecated. * <code>mediawiki</code>: content in this parameter will only be displayed if this template is used on a page in the '''Mediawiki''' space * <code>template</code>: content in this parameter will only be displayed if this template is used on a page in the '''Template''' space * <code>help</code>: content in this parameter will only be displayed if this template is used on a page in the '''Help''' space * <code>category</code>: content in this parameter will only be displayed if this template is used on a page in the '''Category''' space * <code>project</code>: content in this parameter will only be displayed if this template is used on a page in the '''Project''' space (displayed as '''Genshin Impact Wiki''') ; Special Parameters * <code>other</code>: content in this parameter will only be displayed if this template is used on a page whose namespace does not match any of the other explicitly provided parameters to this template * <code>demospace</code>: Optionally specify the name of a namespace to make the template consider itself to be in that namespace rather than the actual namespace of the page. * <code>page</code>: Optionally specify the name of a page to make the template consider itself to be used on that page rather than the actual page ==Examples== ; Example 1 This template takes one or more parameters named after the different page types as listed above. Like this: <pre> {{Namespace |main = Article text |talk = Talk page text |other = Other pages text }} </pre> If the template is on a main (article) page, it will return this: {{Namespace |demospace=main |main = Article text |talk = Talk page text |other = Other pages text }} If the template is on any other page than an article or a talk page, it will return this: {{Namespace | main = Article text | talk = Talk page text | other = Other pages text }} ; Example 2 The example above made the template return something for all page types. But if we don't use the '''other''' parameter or leave it empty, it will not return anything for the other page types. Like this: <pre> {{Namespace |file = File page text |category = Category page text |other = }} </pre> On any pages other than file and category pages the code above will render nothing. <!-- Do not remove this one. It is supposed to render nothing, but we have it here for testing purposes. --> {{Namespace |file = File page text |category = Category page text |other = }} ; Example 3 By using an empty parameter, you can make it so the template doesn't render anything for some specific page type. Like this: <pre> {{Namespace |main = |other = Other pages text }} </pre> The code above will render nothing when on mainspace (article) pages, but will return this when on other pages: {{Namespace |main = |other = Other pages text }} ===Demospace and page=== For testing and demonstration purposes, this template can take two parameters named '''demospace''' and '''page'''. ; Example 1 '''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> {{Namespace |main = Article text |other = Other pages text |demospace = main }} </pre> No matter on what kind of page the code above is used, it will return this: {{Namespace |main = Article text |other = Other pages text |demospace = main }} ; Example 2 The '''page''' parameter instead takes a normal pagename, making this template behave exactly as if on that page. The pagename doesn't have to be an existing page. Like this: <pre> {{Namespace |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 |user = User page text |other = Other pages text |page = User:Example }} ; Example 3 It can be convenient to let your template understand the '''demospace''' and/or '''page''' parameter and send it on to the {{T|Namespace}} template. Like this: <pre> {{Namespace |main = Article text |other = Other pages text |demospace = {{{demospace|}}} |page = {{{page|}}} }} </pre> If both the '''demospace''' and '''page''' parameters are empty or undefined, the template will detect page types as usual. ===Infobox Category Checks=== In many [[:Category:Infobox Templates|infobox templates]] used throughout the wiki, you'll often see category checks at the end of the infobox template. For example: <pre> <includeonly><infobox> ... </infobox> {{Namespace|main=[[Category:Terminology]]<!-- -->{{#if:{{{type|}}}|[[Category:{{{type|}}}]]}}<!-- -->{{#if:{{{type2|}}}|[[Category:{{{type2|}}}]]}}<!-- -->{{#if:{{{type3|}}}|[[Category:{{{type3|}}}]]}}<!-- -->{{#if:{{{region|}}}|[[Category:{{{region}}} Terminology]]}}<!-- -->{{#if:{{{area|}}}|[[Category:{{{area}}} Terminology]]}}<!-- -->}} </includeonly><noinclude>{{Documentation|type=Infobox}}</noinclude> </pre> In this case, the {{T|Namespace}} parameter is being used to ensure that the categories only apply to pages in the Main namespace. So if the infobox template happens to be used in template documentation pages or user pages, then the categories won't be applied. ==Technical details== If you intend to feed tables as content to the numbered parameters of this template, you need to know this: [[m:Help:Templates|Templates]] have a problem handling parameter data that contains pipes "<code>|</code>" unless the pipe is inside another template <code><nowiki>{{name|param1}}</nowiki></code> or inside a piped link <code><nowiki>[[m:Help:Templates|help]]</nowiki></code>. Thus templates can not handle [[m:Help:Tables|wikitables]] as input unless you escape them by using the <code><nowiki>{{!}}</nowiki></code> magic word. This makes it hard to use wikitables as parameters to templates. Instead, the usual solution is to use HTML wikimarkup for the table code, which is more robust.
Summary:
Please note that all contributions to The Petit Planet Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
Petit Planet Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Below are commonly used wikitext from
MediaWiki:Edittools
. Click on any to insert them in the edit box.
File Pages
==Summary==
==Licensing==
{{Fairuse}}
{{File|}}
Dynamic Page List
¦
²
«
»
²{¦}²
«»
«/»
«!----»
Array in DPL
¹
^2{
}^2
^2{¹}^2
Parser Functions
{{#if:||}}
{{#if:<condition>|<result if true>|<result if false>}}
{{#ifeq:|||}}
{{#ifeq:<text1>|<text2>|<result if text1=text2>|<result if text1≠text2>}}
{{#expr:}}
{{#expr:<mathematical expression>}}
{{#switch:||#default=}}
{{#switch:<text1>|<text2>=<result if text1=text2>|<text3>=<result if text1=text3>|#default=<result if no valid match>}}
{{#replace:||}}
{{#replace:<text1>|<plain text to find in text1>|<plain text to insert in place of the text found>}}
{{#titleparts:}}
{{#replace:<page name>}}
{{#tag:|}}
{{#tag:<name of html tag>|<content inside html tag>}}
Markup
{{}}
|
[]
[[]]
[[Category:]]
#REDIRECT [[]] [[Category:Redirect Pages]]
<code></code>
<includeonly></includeonly>
<noinclude></noinclude>
<nowiki></nowiki>
<!---->
<br>
§
Notices
{{Stub|}}
{{Stub Dialogue}}
{{Upcoming}}
{{Under Construction}}
{{Placeholder|}}
Magic Words
{{!}}
{{formatnum:}}
{{lc:}}
{{uc:}}
{{PAGENAME}}
{{FULLPAGENAME}}
{{ROOTPAGENAME}}
{{BASEPAGENAME}}
{{SUBPAGENAME}}
{{DISPLAYTITLE:|noreplace}}
__TOC__
__NOTOC__
__EXPECTUNUSEDCATEGORY__
__HIDDENCAT__
HTML Entities
—
,
­
Pages included on this page:
Template:Array
(
edit
)
Template:Documentation/Header
(
edit
)
Template:Documentation/styles.css
(
edit
)
Template:Exists
(
edit
)
Template:Extension DPL
(
view source
)
Template:High Risk
(
edit
)
Template:Lua
(
edit
)
Template:MessageBox
(
edit
)
Template:Namespace
(
edit
)
Template:T
(
edit
)
Module:Arguments
(
edit
)
Module:Arguments/i18n
(
edit
)
Module:Array
(
edit
)
Module:Common/i18n
(
edit
)
Module:Config
(
edit
)
Module:Documentation
(
edit
)
Module:Documentation/config
(
edit
)
Module:Documentation/i18n
(
edit
)
Module:Entrypoint
(
edit
)
Module:Exists
(
edit
)
Module:Fallbacklist
(
edit
)
Module:Feature
(
edit
)
Module:Formatting
(
edit
)
Module:I18n
(
edit
)
Module:Languages
(
edit
)
Module:Mbox
(
edit
)
Module:Mbox/i18n
(
edit
)
Module:Namespace detect
(
edit
)
Module:Namespace detect/config
(
edit
)
Module:Namespace detect/data
(
edit
)
Module:TableTools
(
edit
)
Module:Yesno
(
edit
)
This page is a member of 2 hidden categories:
Category:Pages using DynamicPageList4 parser function
Category:Pages using DynamicPageList4