Help:Parser functions

From Saintapedia
(Redirected from Parser functions)
Jump to navigation Jump to search
Help
Getting Started
Picking a UsernameTeach Yourself Wiki
Policies and guidelines
Saintapedia:Copyrights
The Saintapedia Interface
Left NavigationToolbox Discussion/Talk PageEdit & HistorySearchLog in & Create an Account
Editing Saintapedia
Creating a new pageCreating your user page • Editors (Visual/Enhanced) • Editing toolbarCheat SheetMagic wordsTable of Contents
Links
Internal linkExternal linkInterWiki linkCategory link Reference links
Images and Media
File Upload Guidelines for SaintapediaHow to upload new versions of filesImage mapNaming Conventions for FilesUpload documents
Tracking Changes
Recent Edits on SaintapediaArticle historyReverting to an earlier versionWatchlistHow to add a page to your watchlist
Asking Questions
Using talk pagesHelp:CommentStreams
Resources and Lists
Categories InfoboxHelp:Templates
Account settings and maintenance
Change your preferences Confirm your email address
Technical information
The MediaWiki softwareParser functions
All topics
view · talk · edit
Help:Extension:ParserFunctions on Mediawiki

Parser functions (a type of magic word, along with behavior switches and variables) are features of wikitext that enable various instructions to be given to the MediaWiki software to produce variable output, as is often required in templates.

Basic parser functions are detailed at Mediawikiwiki:Help:Magic words#Parser functions. Additional parser functions are added by the ParserFunctions extension, and are detailed at Mediawikiwiki:Help:Extension:ParserFunctions.

Examples

{{#time: F j, Y}} will show the current date: January 23, 2025. Other common formats for displaying a date include:

  • {{#time: n/j/y}}: 1/23/25,
  • {{#time: m/d/Y}}: 01/23/2025 (with zero padding added, if necessary, to make the month and day each 2 digits long, and a 4-digit year), and
  • {{#time: Y-m-d}}: 2025-01-23.
  • {{#time: Y F d H:i:s}}: 2025 January 23 02:41:54
  • {{#timel: Y F d H:i:s}}: 2025 January 22 21:41:54

{{#ifexpr: 1 > 0 | yes | no }} can compare values: yes

{{#ifeq: {{#time: D}} | Fri | TGIF!}} will display a message only on Fridays:

{{#switch: {{#time: D}} | Fri=TGIF! | Sat=Weekend | Sun=Weekend | #default=Where's my coffee?}} will display a different message on different days: Where's my coffee?

Navbox

Template:Saintapedia