Jump to content

Help:Magic words for beginners

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2600:1700:ce90:4c00:d54e:a770:1376:9e0b (talk) at 14:31, 3 July 2019 (==Variables== thumb|200px|alt=The Square Root of x|A variable in math. thumb|200px|alt=A mathematical plot.|A plot of variables in algebra.<br>(Though Magic Words are much easier!) ''For documentation, you may wish to read the variables MediaWiki page.'' * <code><nowiki>{{FULLPAGENAME}}</nowiki></code> (The page title, including namespace...). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Magic words are words surrounded by brackets or underscores which most often insert or display the current value of what they are called. These include parser functions, variables and behavior switches and are features of wikitext. They are interpreted by the Metawiki software and are often used in templates so that they show different information depending on which page they are on and many other conditions.

Types

There are three types of magic words:

  • Behavior switches: uppercase words surrounded by double underscores, like. __NOTOC__
  • Variables: uppercase words surrounded by double braces, like {{PAGENAME}}and function somewhat similarly to templates.
  • Parser functions: These include expressions and consist of keywords (some beginning #) in double braces with parameters following a colon, ex. {{#expr:2+2}}

Things To Remember

A Notepad
Remember...
  • Most magic words are not case-sensitive, although some are, so you should be careful
  • Whitespace is not counted in from the front and back of keywords and parameters and the same also applies to template code.
  • "{{ Nofeed |Art=Wikipedia }}" and {{Nofeed|Art=Wikipedia}} will both succeed in producing the "Nofeed" template.
  • Page-dependent magic words will change or show information about the current page, even if the word is from a template, though in most cases, this is the desired effect.
  • If I insert {{exampletemplate}} and it says {{PAGENAME}}, I will see "Magic words for beginners" even though it is from "Template:example template".
  • If you want a magic word to paste in its value at the time of saving, you can substitute it in the same way that templates are substituted (using the subst: keyword).
  • {{CURRENTTIME}} will always display the current time and remain as is, while {{subst:CURRENTTIME}} will result in, for example, 9:45 being inserted and always remaining as regular text.

Behavior Switches

A Magic Wand
The implementation of magic words.

For a more detailed explanation, refer to the behavior switches MediaWiki page.

See also

For more detailed information on all magic words (behaviour switches, variables and parser functions), consider reading: