Editing
Template:Main other/doc
Jump to navigation
Jump to search
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 subpage}} {{used in system}} {{cascade-protected template}} {{Template shortcut|ns0|mo|ao}} <!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE --> This is the {{tl|main other}} meta-template. This template helps other templates detect if they are on a main space (article) page or some "other" type of page. ===Basic usage=== This template usually takes two parameters, like this: : {{Tlc|main other |{{var|result if in mainspace}} |{{var|result if elsewhere}}}} If the template is on a main space (article) page, it will return this: : {{main other |demospace=main |{{var|result if in mainspace}} |{{var|result if elsewhere}} }} If the template is on any other page, it will return this: : {{main other |{{var|result if in mainspace}} |{{var|result if elsewhere}} }} A typical usage case would be to warn that a template should not be used on non-article pages: : {{Tlc|main other | |This template should only be used in articles.}} or vice versa: : {{Tlc|main other |This template should not be used in articles.| }} Note that in the first case above the "main" parameter was not used, and in the second example the "other" parameter was left empty. ===Demospace=== For testing and demonstration purposes, this template can take a parameter named '''demospace'''. * If it has the value '''main''' it returns the article text. * It if has the value '''other''' or any other value such as the name of some other namespace it returns the other pages text. * If the parameter is empty or undefined, the actual page type determines the result. Like this: : {{tlc|main other |{{var|result if in mainspace}} |{{var|result if elsewhere}} |demospace{{=}}main}} No matter on what kind of page the code above is used, it will return: {{main other |{{var|result if in mainspace}} |{{var|result if elsewhere}} |demospace=main}} You can make it so your template also understands the '''demospace''' parameter. That means you can demonstrate the different appearances of your template in the documentation for your template: : {{tlc|main other |{{var|result if in mainspace}} |{{var|result if elsewhere}} |<nowiki>demospace={{{demospace|}}}</nowiki> }} ===Technical details=== This template detects article "Talk:" pages as type '''other'''. This template works like {{tl|main talk other}}. For more examples and technical details, see the documentation there. <templatedata> { "params": { "1": { "label": "If mainspace", "description": "Content if page is located in mainspace (i.e. article space)", "type": "content" }, "2": { "label": "If not mainspace", "description": "Content if page is not located in mainspace", "type": "content" } } } </templatedata> ===Redirects=== * {{tl|article only}} * {{tl|article other}} {{Namespace and pagename-detecting templates}} <includeonly>{{Sandbox other|| [[Category:Namespace manipulation templates]] [[Category:If-then-else templates]] }}</includeonly>
Summary:
By saving changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Cascade-protected template
(
edit
)
Template:Documentation subpage
(
edit
)
Template:Hlist/styles.css
(
edit
)
Template:Main other
(
edit
)
Template:Mbox
(
edit
)
Template:Namespace and pagename-detecting templates
(
edit
)
Template:Navbox
(
edit
)
Template:No redirect
(
edit
)
Template:Plainlist/styles.css
(
edit
)
Template:Sandbox other
(
edit
)
Template:Str endswith
(
edit
)
Template:Strong
(
edit
)
Template:Template link
(
edit
)
Template:Template link bare
(
edit
)
Template:Template link code
(
edit
)
Template:Template shortcut
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Tl
(
edit
)
Template:Tlbare
(
edit
)
Template:Tlc
(
edit
)
Template:Used in system
(
edit
)
Template:Var
(
edit
)
Module:Arguments
(
view source
) (protected)
Module:High-use
(
edit
)
Module:List
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Navbar
(
edit
)
Module:Navbar/configuration
(
edit
)
Module:Navbar/styles.css
(
edit
)
Module:Navbox
(
edit
)
Module:Navbox/configuration
(
edit
)
Module:Navbox/styles.css
(
edit
)
Module:Redirect
(
edit
)
Module:Shortcut
(
edit
)
Module:Shortcut/config
(
edit
)
Module:Shortcut/styles.css
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Template link general
(
edit
)
Module:Text
(
edit
)
Module:Text/data
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/M
(
edit
)
Module:Yesno
(
view source
) (protected)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Template
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Donate
Tools
What links here
Related changes
Upload file
Special pages
Page information