You must log in to edit. If you don't have an account create one now!

Help:Variables

From WikiStory

Jump to: navigation, search
(Certain parts of this page, marked in its source, is/are in the public domain.)

Variables or Magic words are strings of text that are associated with a return value or function, such as time, site details, or page names.

Contents

General notes

  • Inheritance: page-dependent magic words will affect or return data about the current page, regardless of whether it is in the page code or a transcluded template.

Behaviour switches

A behaviour switch controls the layout of the page. They are written as a magic word wrapped with double underscores.

Word Description
Table of contents
__NOTOC__ Hides the table of contents (TOC).
__FORCETOC__ Forces the table of content to appear at its normal position (above the first header).
__TOC__ Places a table of contents at the word's current position (overriding __NOTOC__). If this is used multiple times, the table of contents will appear at the first word's position.
Editing
__NOEDITSECTION__ Hides the section edit links beside headings.
__NEWSECTIONLINK__ Adds a link ("+") beside the "edit" tab for adding a new section on a non-talk page.
Categories
__NOGALLERY__ Used on a category page, replaces thumbnails in the category view with normal links.
__HIDDENCAT__ Used on a category page, hides the category from the lists of categories in its members and parent categories (there is an option in the author preferences to show them).

Variables

The syntax of variables is similar to templates, but capitalized to help avoid conflicts. If a template has the same name and case as a variable, the variable will be used. Usage of the template can be forced by adding the "msg:" modifier (for example, "{{msg:CURRENTYEAR}}"). In some cases, adding parameters will force the parser to treat a variable as a template; for example, {{CURRENTDAYNAME|x}} tries to transclude "Template:CURRENTDAYNAME".

Date & time

The following variables return the current date and time according to the author's timezone preferences, defaulting to the UTC timezone.

Due to browser caching, these variables frequently show when the page was cached rather than the current time.

Variable Output Description
Year
{{CURRENTYEAR}} 2009 Year
Month
{{CURRENTMONTH}} 01 Month (zero-padded number)
{{CURRENTMONTHNAME}} January Month (name)
{{CURRENTMONTHNAMEGEN}} January Month (genitive form)
{{CURRENTMONTHABBREV}} Jan Month (abbreviation)
Day
{{CURRENTDAY}} 6 Day of the month (unpadded number)
{{CURRENTDAY2}} 06 Day of the month (zero-padded number)
{{CURRENTDOW}} 2 Day of the week (unpadded number)
{{CURRENTDAYNAME}} Tuesday Day of the week (name)
Time
{{CURRENTTIME}} 01:50 Time (24-hour HH:mm format)
{{CURRENTHOUR}} 01 Hour (24-hour zero-padded number)
Other
{{CURRENTWEEK}} 2 Week (number)
{{CURRENTTIMESTAMP}} 20090106015021 ISO 8601 time stamp

The following variables do the same as the above, but using the site's local timezone instead of author preferences and UTC:

  • {{LOCALYEAR}}
  • {{LOCALMONTH}}
  • {{LOCALMONTHNAME}}
  • {{LOCALMONTHABBREV}}
  • {{LOCALDAY}}
  • {{LOCALDAY2}}
  • {{LOCALDOW}}
  • {{LOCALDAYNAME}}
  • {{LOCALTIME}}
  • {{LOCALHOUR}}
  • {{LOCALWEEK}}
  • {{LOCALTIMESTAMP}}

Technical metadata

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

Variable Output Description
Latest revision to current page
{{REVISIONID}} 470 Unique ID
{{REVISIONDAY}} 26 Day edit was made (unpadded number)
{{REVISIONDAY2}} 26 Day edit was made (zero-padded number)
{{REVISIONMONTH}} 5 Month edit was made (unpadded number)
{{REVISIONYEAR}} 2008 Year edit was made
{{REVISIONTIMESTAMP}} 20080526215710 Timestamp as of time of edit

Statistics

Numbers returned by these variables contain number separators, but can return raw numbers with the ":R" flag (for example, {{NUMBEROFPAGES}} = 327 and {{NUMBEROFPAGES:R}} = 327). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example {{PAGESINCATEGORY:Help}} and {{PAGESINCATEGORY:Help|R}}).

Variable Output Description
Entire wiki
{{NUMBEROFPAGES}} 327 Number of wiki pages.
{{NUMBEROFARTICLES}} 12 Number of pages in main namespace.
{{NUMBEROFFILES}} 0 Number of uploaded files.
{{NUMBEROFEDITS}} 921 Number of page edits.
{{NUMBEROFUSERS}} 122 Number of registered authors.
{{NUMBEROFADMINS}} 1 Number of Admnistrators.

URL data

URLs

Variable Output Description
{{SERVER}} http://www.wikistory.com domain URL
{{SERVERNAME}} www.wikistory.com domain name
{{SCRIPTPATH}} /ws relative script path
{{localurl:page name}}
{{localurl:page name|query string}}
/wiki/Page_name
/ws/index.php?title=Page_name&query string
relative path to title
{{fullurl:page name}}
{{fullurl:page name|query string}}
http://www.wikistory.com/wiki/Page_name
http://www.wikistory.com/ws/index.php?title=Page_name&query string
absolute path to title

Page names

Variable Output Description
{{FULLPAGENAME}} Help:Variables Namespace and page title.
{{PAGENAME}} Variables Page title.
{{BASEPAGENAME}} Variables Page title excluding the current subpage and namespace ("Title" on "Title/foo").
{{SUBPAGENAME}} Variables The subpage title ("foo" on "Title/foo").
{{SUBJECTPAGENAME}} Help:Variables The namespace and title of the associated content page.
{{TALKPAGENAME}} Help talk:Variables The namespace and title of the associated talk page.

The following are URL-encoded equivalents:

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

Namespaces

Variable Output Description
{{NAMESPACE}} Help Namespace (name)
{{SUBJECTSPACE}} Help Name of the associated content namespace
{{TALKSPACE}} Help talk Name of the associated talk namespace

The following are URL-encoded equivalents:

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

{{ns:}} returns the localized namespace name for that number of constant. The default values are:

Usage Output
{{ns:-2}} or {{ns:Media}} Media
{{ns:-1}} or {{ns:Special}} Special
{{ns:0}}
{{ns:1}} or {{ns:Talk}} Talk
{{ns:2}} or {{ns:User}} (Author Namspace) Author
{{ns:3}} or {{ns:User_talk}} (Author Talk Namespace) Author_talk
{{ns:4}} or {{ns:Project}} WikiStory
{{ns:5}} or {{ns:Project_talk}} WikiStory_talk
{{ns:10}} or {{ns:Template}} Template
{{ns:11}} or {{ns:Template_talk}} Template_talk
{{ns:12}} or {{ns:Help}} Help
{{ns:13}} or {{ns:Help_talk}} Help_talk
{{ns:14}} or {{ns:Category}} Category
{{ns:15}} or {{ns:Category_talk}} Category_talk
{{ns:100}} or {{ns:Plot}} Plot
{{ns:101}} or {{ns:Plot_talk}} Plot_talk
{{ns:110}} or {{ns:Character}} Character
{{ns:111}} or {{ns:Character_talk}} Character_talk
{{ns:120}} or {{ns:Poem}} Poem
{{ns:121}} or {{ns:Poem_talk}} Poem_talk
{{ns:500}} or {{ns:Reviews}} Reviews
Personal tools