Mw:Help:Magic words

From WikiMD's Wellness Encyclopedia


Magic words are a technique used in MediaWiki to achieve effects like variable substitution, modification of the behavior of the wiki text, and switching the inclusion of portions of pages. These are powerful tools that can control the content and presentation of the wiki without requiring direct editing of the underlying source code.

Overview

Magic words are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names. There are three general types of magic words:

  • Behavior switches: These are uppercase words surrounded by double underscores, e.g., .
  • Variables: These resemble templates but are built into MediaWiki and often provide information about the current page, wiki, or date. Their syntax is typically 19, WikiMD's Wellness Encyclopedia, etc.
  • Parser functions: These take parameters and resemble templates, used in more complex operations, e.g., ....

Types of Magic Words

Behavior Switches

Behavior switches control the layout or behavior of the page. For example:

  • - Hides the table of contents on a page.
  • - Removes the edit links next to section headers.
  • - Adds a link to create a new section on a non-talk page.

Variables

Variables return information about the current date, wiki information, or details about the current page. Examples include:

  • 19 - Renders the current day of the month.
  • WikiMD's Wellness Encyclopedia - Shows the name of the wiki.
  • Mw:Help:Magic words - Displays the name of the current page.

Parser Functions

Parser functions can manipulate strings, conditional expressions, and other data. Common examples are:

  • 0 - Evaluates a mathematical expression.
  • ... - Implements conditional statements.
  • - Selects a case to display.

Usage

Magic words are used directly in the wiki text. Users can employ them to automate content, influence the wiki’s rendering, or extract data dynamically. They are particularly useful in templates and system messages to adapt the content to different circumstances without manual intervention.

See Also

Categories

Template:Mediawiki-stub

Wiki.png

Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes

Search WikiMD


Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD

WikiMD is not a substitute for professional medical advice. See full disclaimer.

Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.

Contributors: Prab R. Tumpati, MD