Help:Page existence

From The Scuba Wiki

Jump to: navigation, search
MediaWiki Handbook: Contents, Readers, Editors, Moderators, System admins +/-

Contents

Wikitext methods to determine whether a page exists:

methodwhat links here <ref>applying "what links here" on a probed page shows the page on which this method is applied</ref>transclusion <ref>the probed page is counted as transcluded onto the page on which this method is applied; this shows up in the edit page of the latter, and on "what links here" on the probed page</ref>limitationusageinterwiki link<ref>applies with a correct prefix, regardless of existence of the linked page</ref>pagename with anchor
#ifexistyesno<ref>If a page is conditionally transcluded, namely only if it exists, then if the then-part of the #ifexist is this transclusion, it counts as a transclusion anyway, even if the page does not exist. However, if the then-part of the #ifexist is the name of the page to be transcluded, and the else-part is e.g. the page "dummy", and we have outer double braces to transclude the page with this conditional name, then only real transclusions are listed.</ref>not more than now 500 on a page<ref>On Wikimedia wikis there is a maximum for the number of distinct pages for which #ifexist is called on a page. A call of #ifexist after a transclusion of the same page does not require an extra database query and is therefore not counted. A call beyond the maximum returns "false". The html-source of each page shows the counted number of calls, as well as the maximum. The maximum is currently 500, and it has been announced that this will be lowered to 100. [1] [2] w:wikipedia:Template limits.

</ref>||branching||"does not exist"||checks page existence correctly, but not the existence of the anchor

#ifeq applied to the transclusion and the link: equality means non-existence; this is applied in template:exists ( talk edit history links ), where care is taken that the comparison is insensitive to the applicable conversionsyesyes branching"exists""exists"
linking: class="new" means non-existenceyesnononeseeing the page link in a style depending on existenceclass="extiw"checks page existence correctly, but not the existence of the anchor
Special:Allpagesnonononeseeing the page listed or notnot listedn.a.
Special:PrefixIndexnonononeseeing the page listed or notnot listedn.a.

Examples:

{{Special:PrefixIndex/exist}} gives:



Another method is, of course, going to the web address concerned and seeing the content or a message that the page does not exist.

Branching applications

A typical application of existence detection is:

  • producing the content of a page if it exists, otherwise some default

with the important special case:

  • producing the content of a page if it exists, otherwise nothing

If the set of possible pages is limited then an alternative is creating them all, with the extra pages containing the default value(s), and unconditionally transcluding the pages.

CSS class

If existence is checked in order to hide red links, an alternative for {{#ifexist:foo|[[foo]]}} and {{exists|foo|[[foo]]}} is <span class="hidden-redlink">[[foo]]</span>, giving "foo", where we have the CSS specification

.hidden-redlink a.new { display: none; }

(which on Meta has been added to Mediawiki:Common.css).

Conversely an emphasized style could be used for red links, or only red links could be displayed.

Notes

<references />

See also


Links to other help pages

Help contents
Meta | Wikinews | Wikipedia | Wikiquote | Wiktionary | commons: | mw: | b: | s: | mw:Manual | google
Versions of this help page (for other languages see below)
Meta | Wikinews | Wikipediahttp://en.wikipedia.org/Help:Page_existence | Wikiquote | Wiktionary
What links here on Meta or from Meta | Wikipedia | MediaWiki
Reading
Go | Search | Stop words | URL | Namespace | Page name | Section
Backlinks | Link | Piped link | Interwiki link | Redirect | Category | Image page
Logging in and preferences
Logging in | Preferences | User style
Editing
Advanced editing | Editing FAQ | Edit toolbar | Export | Import | Shortcuts
Tracking changes
Recent changes (enhanced) | Related changes | Watching pages | Diff
Page history | Edit summary | User contributions | Minor edit | Patrolled edit
Style & formatting
Wikitext examples | Reference card | HTML in wikitext | List | Table | Sorting | Colors
Special input and output
Inputbox | Special characters | Displaying a formula | Images (uploads) | EasyTimeline
Advanced functioning
Template | Advanced templates | Parser function | ParserFunctions | Parameter default
Variable | Magic word | System message | Substitution | Array | Calculation
Page management
Starting a new page | Renaming (moving) a page | Protecting pages | Deleting a page
Special pages
Talk page | Testing | Sandbox | CentralNotice

Template:-


Personal tools
support the site