Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Help:Variables

Page semi-protected
From Wikibooks, open books for an open world
Wikibooks Help

About Wikibooks
FAQs
Glossary

Navigating

Pages
Tracking changes
Account management

Contributing

Editing
Categories
Files
Tables
Templates
Variables
Formulas
Quizzes
Styling
Collections
Importing

Variables return information about the current page, wiki, or date. Their syntax is similar totemplates.

Most variables (except forpseudo variables below) are types of "magic words". Seemagic words at MediaWiki for a complete list.


Date and time

The following variables return the current date and time inUTC.

Due to software and browser caching, these variables frequently show when the page wascached rather than the current time.

VariableOutputDescription
{{CURRENTYEAR}}2025Year
{{CURRENTMONTH}}12Month (zero-padded number)
{{CURRENTMONTHNAME}}DecemberMonth (name
{{CURRENTMONTHNAMEGEN}}DecemberMonth (genitive form)
{{CURRENTMONTHABBREV}}DecMonth (abbreviation)
{{CURRENTDAY}}16Day of the month (unpadded number)
{{CURRENTDAY2}}16Day of the month (zero-padded number)
{{CURRENTDOW}}2Day of the week (unpadded number)
{{CURRENTDAYNAME}}TuesdayDay of the week (name)
{{CURRENTTIME}}18:32Time (24-hour HH:mm format)
{{CURRENTHOUR}}18Hour (24-hour zero-padded number)
{{CURRENTWEEK}}51Week (number)
{{CURRENTTIMESTAMP}}20251216183249YYYYMMDDHHmmss timestamp

Technical metadata

Revision variables return data about thelatest edit to the current page, even if viewing an older version of the page.

Site

VariableOutputDescription
{{SITENAME}}WikibooksThe wiki's site name
{{SERVER}}//en.wikibooks.orgdomain URL
{{SERVERNAME}}en.wikibooks.orgdomain name
{{SCRIPTPATH}}/wrelative script path
{{STYLEPATH}}/w/skinsrelative style path
{{CURRENTVERSION}}1.46.0-wmf.5 (c71d2ed)The wiki's MediaWiki version.
{{CONTENTLANGUAGE}}
{{CONTENTLANG}}
en
en
The wiki's default interface language

Latest revision to current page

VariableOutputDescription
{{REVISIONID}}-Unique revision ID
{{REVISIONDAY}}1Day edit was made (unpadded number)
{{REVISIONDAY2}}01Day edit was made (zero-padded number)
{{REVISIONMONTH}}12Month edit was made (zero-padded number)
{{REVISIONYEAR}}2022Year edit was made
{{REVISIONTIMESTAMP}}20221201134647Timestamp as of time of edit
{{REVISIONUSER}}Xeverything11The username of the user who made the most recent edit to the page, or the current user when previewing an edit

Statistics

Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example,{{NUMBEROFPAGES}} → 295,565 and{{NUMBEROFPAGES:R}} → 295565). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example{{PAGESINCATEGORY:Help}} and{{PAGESINCATEGORY:Help|R}}).

VariableOutputDescription
{{NUMBEROFPAGES}}295,565Number of wiki pages.
{{NUMBEROFARTICLES}}98,422Number of pages in content namespaces.
{{NUMBEROFFILES}}2,474Number of uploaded files.
{{NUMBEROFEDITS}}4,433,904Number of page edits.
{{NUMBEROFUSERS}}3,532,211Number of registered users.
{{NUMBEROFADMINS}}12Number of users in theadministrator group.
{{NUMBEROFACTIVEUSERS}}575Number of active users, based on the criteria used inSpecial:Statistics.
{{NUMBERINGROUP:groupname}}
{{NUMINGROUP:groupname}}
0
0
({{NUMBERINGROUP:bureaucrat}} used here)
Number of users in a specific group.

Namespaces

VariableOutputDescription
{{NAMESPACE}}HelpName of the page's namespace
{{SUBJECTSPACE}}
{{ARTICLESPACE}}
Help
Help
Name of the associated content namespace
{{TALKSPACE}}Help talkName of the associated talk namespace

The following are equivalents encoded for use in URLs (spaces replaced with underscores and some characters percent-encoded):

  • {{NAMESPACEE}}
  • {{SUBJECTSPACEE}}
  • {{TALKSPACEE}}

These can take a page name and will return the namespace of the page name parameter, instead of the current page's:

  • {{NAMESPACE:Template:Main Page}}Template
  • {{SUBJECTSPACE:Template:Main Page}}Template
  • {{TALKSPACE:Template:Main Page}}Template talk

Page names

VariableOutputDescription
{{FULLPAGENAME}}Help:VariablesNamespace and page title.
{{PAGENAME}}VariablesPage title, excluding namespace.
{{BASEPAGENAME}}VariablesPage title excluding the current subpage and namespace ("Title/foo" on "Title/foo/bar").
{{SUBPAGENAME}}VariablesThe subpage title ("foo" on "Title/foo").
{{ROOTPAGENAME}}VariablesTitle of the topmost parent, excluding namespace and anything after the first slash ("Title" on "Wikijunior:Title/foo/bar").
{{SUBJECTPAGENAME}}Help:VariablesThe namespace and title of the associated content page.
{{TALKPAGENAME}}Help talk:VariablesThe namespace and title of the associated talk page.

The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characterspercent-encoded):

  • {{FULLPAGENAMEE}}
  • {{PAGENAMEE}}
  • {{BASEPAGENAMEE}}
  • {{SUBPAGENAMEE}}
  • {{ROOTPAGENAMEE}}
  • {{SUBJECTPAGENAMEE}}
  • {{TALKPAGENAMEE}}

These can all allow specification of the page to be operated on, instead of just the current page:

  • {{PAGENAME:Template:Main Page}}Main Page

Pseudo variables

Sometemplates have been created that mimic the above variables. While the variables in the above section use a colon (:) to specify a page for output if desired, these will use a pipe (|) for inputting a page. For example,{{BOOKNAME|Wikijunior:Bugs}} can be used to get Wikijunior:Bugs.

TemplateDescription
{{NUMBEROFBOOKS}}Returns the number of books at Wikibooks.
{{BOOKTEMPLATE}}Returns the name of a template with the same name as the book it's used in.
{{BOOKNAME}}Returns the name of the book associated with the page on which it's used.
{{NAIVEBOOKNAME}}Returns the namespace and rootpagename of the page.
{{BOOKTALKNAME}}Returns the associated discussion page for a book as a whole.
{{CHAPTERNAME}}Returns the chapter that a page is in and ignores anything beyond that.
{{BOOKPAGENAME}}Returns all of a page name except the name of the book.
{{BOOKSORTKEY}}Returns all of a subpage name except the name of the book, or the book name if the page isn't a subpage.

For the latter templates, it's easier to see the difference between them by viewing a side-by-side comparison of their outputs.

Input Pages and Outputs
TemplateChess/Puzzles/DirectmatesWikijunior:Dinosaurs/ApatosaurusCategory:Book:Horticulture/Templates/BoxesWikijunior talk:Bugs/Shield Bug
{{BOOKNAME}}ChessWikijunior:DinosaursHorticultureWikijunior:Bugs
{{NAIVEBOOKNAME}}ChessWikijunior:DinosaursCategory:Book:HorticultureWikijunior talk:Bugs
{{BOOKTALKNAME}}Talk:ChessWikijunior talk:DinosaursTalk:HorticultureWikijunior talk:Bugs
{{CHAPTERNAME}}PuzzlesApatosaurusTemplatesShield Bug
{{BOOKPAGENAME}}Puzzles/DirectmatesApatosaurusTemplates/BoxesShield Bug
{{BOOKSORTKEY}}Puzzles/DirectmatesApatosaurusTemplates/BoxesShield Bug


Wikibooks editor navigation
Content
FAQs
Help
Templates
Reading room
Useful pages
Other
project pages
Retrieved from "https://en.wikibooks.org/w/index.php?title=Help:Variables&oldid=4214958"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp