Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Guild of Archivists
Search
Editing
Template:When pagename is/doc
(section)
From Guild of Archivists
Namespaces
Template
Discussion
More
More
Page actions
Read
Edit source
History
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!
== Usage == This template takes one or more parameters. Most of the parameters don't have fixed names, instead they are part of the pattern matching. Like this: <pre> {{When pagename is | /doc = Doc page text | other = Other pages text }} </pre> If the template is on "Template:Example/doc" the code above will return this: : {{When pagename is | /doc = Doc page text | other = Other pages text | page = Template:Example/doc }} If the template is on any ''other'' page than a /doc page it will return this: : {{When pagename is | /doc = Doc page text | other = Other pages text | page = Template:Example }} Here is a description of the full pattern matching: <pre> {{When pagename is <!-- Match on full pagename --> | User:Example/test = Text for "User:Example/test". | User:Example = Text for "User:Example". | User talk:Example = Text for "User talk:Example". <!-- Match on full basepage name, when on a basepage or its subpages --> | User:Example/+ = Matches "User:Example" and "User:Example/test". <!-- Match on pagename, when on a basepage --> | Example = Matches "User:Example", "User talk:Example", "Template:Example" and so on, but not "User:Example/something". <!-- Match on full basepage name, when on a subpage --> | User:Example/* = Matches "User:Example/something", but not "User:Example". | User talk:Example/* = Matches "User talk:Example/something". <!-- Match on basepage name, when on a subpage --> | Example/* = Matches "User:Example/something" and "User talk:Example/something". <!-- Match on subpage name --> | /something = Any pagename that ends in "/something". | /doc = Any pagename that ends in "/doc". <!-- Match on partial subpage name (case-insensitive) --> | /some* = Any subpage name beginning with "/some" or "/Some". | /arch* = Matches "User talk:Example/Archive 1". <!-- Defaults --> | basepage = Text for any basepage. | subpage = Text for any subpage. | other = Text for any page. }} </pre> The matching goes from top to bottom, and returns the first parameter that matches. "''Top to bottom''" means the order shown above, not the order you happen to feed the parameters. There's no limit to the number of parameters that you can use, other than what the servers and MediaWiki system can handle. Most of the matching is case-sensitive. For instance "<code>/test</code>" matches "User:Example/test" but not "User:Example/Test". Matching on partial subpage names such as "<code>/some*</code>" has some limitations, see [[#Partial subpage names|its own section]] below. If an empty (but defined) parameter matches, the matching stops and the template returns an empty string. That's on purpose and can be used like this: <pre> {{When pagename is | /doc = | /sandbox = Sandbox text | other = Other pages text }} </pre> The code above will render nothing when on a /doc page. But when on a /sandbox page it will return this: : {{When pagename is | /doc = | /sandbox = Sandbox text | other = Other pages text | page = Template:Example/sandbox }} And when on any other page it will return this: : {{When pagename is | /doc = | /sandbox = Sandbox text | other = Other pages text | page = Template:Example }}
Summary:
Please note that all contributions to Guild of Archivists may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
GoArch:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main Page
Random page
Categories
All pages
Recent changes
Resources
D'ni dictionary
Reference material
Utilities
Community
Forums
Jalak Game Directory
Projects
Apocrypha
Unexplored Branches
All projects
Contribute
Stubs
Wanted
Cleanup
Dead ends
Image requested
Help
Help
Guide
Policies
Wiki tools
Wiki tools
Special pages
Page values
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs