Help talk:Magic words

Jump to: navigation, search
An archive box
/Archive 001

{{REVISIONxxx:Foo}}[edit source]

Is there any way to get revision information using the magic words for another page such as getting {{REVISIONUSER:Foo}} or {{REVISIONTIMESTAMP:Foo}} from [[Bar]]? This would be useful for keeping track of articles in a project for a list of pages. Technical 13 (talk) 15:44, 22 May 2013 (UTC)

No. This can be handled by a DynamicPageList extension, though. --Ciencia Al Poder (talk) 09:11, 23 May 2013 (UTC)
+1 for feature request -- sir KitKat 07:38, 15 October 2013 (UTC)
  • Yes, this has worked for some time now. Guess no-one has patrolled this page in a while... Foo was lasted edited on (06:19:18 on October 10, 2015) by ([[User:]]). Technical 13 (talk) 19:53, 10 November 2014 (UTC)

_NOEDITSECTION_ on every page?[edit source]

Hey there, I am using Mediawiki and I have problems with partly editing of pages, so I want to disable the "edit section" Button for the whole wiki. Is this possible?

If there was such a thing, I would think it would be listed on Manual:Configuration settings (alphabetical), which it is not. However, depending on which version of MediaWiki you are running you could just set the class (use to be .editsection but was recently renamed .mw-editsection on some wikis like en.wikipedia) for to display: none; in your MediaWiki:Common.css -- Technical 13 (talk) 12:48, 15 June 2013 (UTC)

I'd like to be able to do this too[edit source]

I don't understand the answer saying that you set \<code\> display: none; \</code\> - where would you set that?

Isn't there a switch you can set in LocalSettings.php to change the behaviour so that, by default, all sections are displayed without a edit -- so you'd, instead, need to specify __EDITSECTION__ if you wanted a particular section to display an edit.

Fustbariclation (talk) 08:32, 10 January 2014 (UTC)

  • As I said above, you would add:
.editsection {
    display: none;
or possibly, depending on the version of MW you are running:
.mw-editsection {
    display: none;
to your MediaWiki:Common.css. Technical 13 (talk) 19:46, 10 November 2014 (UTC)

__DISAMBIG__[edit source]

Could someone please add the necessary documentation for __DISAMBIG__ (Extension:Disambiguator) here and, if you could be so kind, also at en:Wikipedia:Magic words? Thank you. -- Michael Bednarek (talk) 13:48, 11 July 2013 (UTC)

  • I was under the impression that this page was reserved for core (or at least ships with core extension) magic words and I don't remember seeing Extension:Disambiguator being in that package. Is this going to be a new inclusion in the default package? Technical 13 (talk) 10:26, 17 July 2013 (UTC)
    • When I look up magic words on the EN Wikipedia, I often end up looking at Help:Magic words here on MediaWiki, because that page is linked there, e.g. at en:Help:Magic words. My impression, which may well be wrong, is that MediaWiki documents the MediaWiki software. If that is not so, feel free to remove the entry about __DISAMBIGUATE__ again; in that case, I wonder whether it would be better to remove the mentioned link to MediaWiki at "en:Help:Magic words" as well. -- Michael Bednarek (talk) 12:21, 17 July 2013 (UTC)

Number of files in Articles[edit source]

Hi, Is there any way to be able to count the number of files (In my case: Images) shown in article/category? In other words, I want to have the number of occurrence of any [[file:...]] in given article.

TNX -- 13:01, 23 October 2013 (UTC)

Fullurle[edit source]

The magic word {{fullurle:}} is not described in this page, and I honestly don't know the difference between that and {{fullurl:}}. Cainamarques (talk) 21:32, 6 December 2013 (UTC)

Displaying the article's author on the page[edit source]

Is there any magic word for that? For example {{REVISIONUSER}} displays the username/IP of the last user, who edited the article. How to display the username/IP of the user, who created the article?-- 09:45, 17 April 2014 (UTC)

No. That would be an expensive operation, as MediaWiki should find the first revision of the current page. --Ciencia Al Poder (talk) 16:53, 17 April 2014 (UTC)

Adding translatable docu to such a page is horrifying[edit source]

This diff together with translate tags etc. causes fatals, so I gave up. Sorry for this. The standard nonsense error message "Fatal exception of MediaWiki exception" or what this is called will probably not help digging into the issue. --[[kgh]] (talk) 22:32, 4 July 2014 (UTC)

anchorencode[edit source]

Did somebody change anchorencode ?

It now seems to strip italic markup, rather than encode it:

{{anchorencode:Glasgow Digital Library, ''Omond House''}} -> Glasgow_Digital_Library.2C_Omond_House

It just means that on en-wp, we have to clean up a few hundred articles where en:template:SfnRef (which uses anchorencode to generate anchors in footnotes) has anchors that are generated from italicised words. --RexxS (talk) 16:30, 6 July 2014 (UTC)

Variables that affect behaviour[edit source]

Why are {{DISPLAYTITLE:title}} and {{DEFAULTSORT:sortkey}} listed under Variables when they do not "return information about the current page, wiki, or date"? Surely, since they "control the layout or behavior of the page", they should be listed at Behavior switches. This has come up at w:en:Help talk:Magic words#Three "behavior switches" that aren't. --Redrose64 (talk; at English Wikipedia) 10:14, 17 July 2014 (UTC)

I surmise it's because "switches" have a special __FORMAT__ that doesn't accommodate parameters, whereas DISPLAYTITLE: and DEFAULTSORT: require them. Of the "variables" listed on this Help page, those that take parameters use them only to specify the object about which the "variable" should return information. As DISPLAYTITLE: and DEFAULTSORT: use parameters to set environmental states rather than report them, they are certainly a special case. Maybe they (along with NOEXTERNALLANGLINKS:) should be described as "environment variables", "behavior variables", or "behavior functions", and be placed in their own section or subsection in the page.
My suggestion at this point would be to rename the current "Behavior switches" section to "Behavior settings", move the current content of that section into a subsection called "Behavior switches", and add a second subsection called "Behavior functions" where DISPLAYTITLE:, DEFAULTSORT:, and NOEXTERNALLANGLINKS: are explained. I would also suggest that the list of "general types of magic words" in the lede be rewritten accordingly, mentioning the differences in effect, as well as in format, of the various kinds of magic words.
As an aside, I note that the keywords called "variables" on this Help page would probably be more accurately described as "functions", as they are used to return values that report some aspect of the environment, rather than to store arbitrarily-assigned values. But I guess that's a whole 'nother ball o' wax. — Jaydiem (talk) 16:56, 17 July 2014 (UTC)

Pages in category + sub categories[edit source]

Is there a deeper penetrating {{Pagesincategory that will also count the pages in the subcategories? That would be wonderful. Kmath87 (talk) 22:02, 8 August 2014 (UTC)

  • Not built in to the parser, Kmath87, no. You will have to use a recursive template, some kind of E:Loops, Lua (scribunto if I spelled that right), or javascript via the api if you want to have a count of all pages in a category & subcats. Technical 13 (talk) 12:14, 9 September 2014 (UTC)

What is the opposite of 21010?[edit source]

If I know the page ID number, how do I find the page?

I see that, if I have the page name, the 21010 will give me the number, I'd just like to do it the other way around. 09:08, 20 August 2014 (UTC)

Missing magic words[edit source]

It looks like the following magic isnt listed:
{{CURRENTMONTH1}} gives 10
{{CURRENTMONTH2}} gives 10
{{LOCALMONTH1}} gives 10
{{LOCALMONTH2}} gives 10
{{ARTICLEPATH}} gives /wiki/$1
{{ROOTPAGENAME}} gives Magic words
{{ROOTPAGENAMEE}} gives Magic_words
Christian75 (talk) 07:30, 30 September 2014 (UTC)

Maybe because the first four are considered the same as
  • {{CURRENTMONTH}} gives 10
  • {{LOCALMONTH}} gives 10
As of today, the last two have been included on the page. Bennylin (talk) 10:14, 10 December 2014 (UTC)

Magic Word '{{!}}'[edit source]

When I created the template for this magic word, I was having an issue using it with tables when I passed them in parameters for templates. I was using the <noinclude /> syntax for specifying why I created the template. One thing to note is that the '|' character must come immediately after the closing tag. Otherwise, the white space messes up the parsing of the character when being used in tables; at least for what I was using it for. A newline simply doesn't cut it.
--Erutan409 (talk) 14:48, 5 October 2014 (UTC)

I have the same issue, have you found the solution?... Crystian

Proposition of text changes and errors.[edit source]

  • In {{CASCADINGSOURCES:page name}} page name is nor translatable.
  • Where says:
    • "exactly as formatnum formats them with the wiki's locale" must be "exactly as formatnum formats them with the wiki's locale"
    • "are changed; formatnum will only transform" must be "are changed; formatnum will only transform"

--Jmarchn (talk) 06:26, 10 October 2014 (UTC)

Magic word print username??[edit source]

There is some word that prints the username of the user who is seeing some page where is that MAGICWORD?-- Crystian Marquez

Crystian Marquez, Did you find any solution? --Mavrikant (talk) 16:34, 22 February 2015 (UTC)

Creation date[edit source]

How can i get the "creation date" of a page? ... There exist some MAGICWORD?... or there exist a parser for get the creation date of a page?

I don't think that's possible by current Magic words. Bennylin (talk) 10:01, 10 December 2014 (UTC)

{{filepath:file_name.pdf}}[edit source]

How to create a filepath for a specific page in a PDF or DJVU? It only accept one parameter, thumb size, and right now it only works for the first page of the PDF. Thanks. Bennylin (talk) 08:54, 10 December 2014 (UTC)

My current workaround on includes\parser\CoreParserFunctions.php (MW 23.1) is by adding the third argument ($argC) and one line of code. So now I could call the thumbnail for page 2 of the PDF {{filepath:file_name.pdf|100px||2}}. I'm not sure this is the best solution though. Bennylin (talk) 09:58, 10 December 2014 (UTC)
	public static function filepath( $parser, $name = '', $argA = '', $argB = '', $argC = '' ) {
		$file = wfFindFile( $name );

		if ( $argA == 'nowiki' ) {
			// {{filepath: | option [| size] }}
			$isNowiki = true;
			$parsedWidthParam = $parser->parseWidthParam( $argB );
		} else {
			// {{filepath: [| size [|option]] }}
			$parsedWidthParam = $parser->parseWidthParam( $argA );
			$isNowiki = ( $argB == 'nowiki' );
                $parsedWidthParam['page'] = $argC;

Magic Word for IP address lookup[edit source]

Are there any magic words to look up someone's IP address? 19:53, 28 December 2014 (UTC)

There is a special user right to get this data at all (checkuser or oversight, I always forget what is what). IOW, no. –Be..anyone (talk) 11:47, 29 December 2014 (UTC)

language magic word[edit source]

It would appear that {{#language:<code>|en}} where <code> is an ISO 639-3, three letter language code, either doesn't work as it should or that the documentation, such as it is, that suggests that ISO 639-3 language codes should work, is incorrect:

{{#language:ara|en}} → ara

As a check, switching to ISO 639-1 works:

{{#language:ar|en}} → Arabic

So, the questions are:

  1. Should {{#language:}} return a language name for three character ISO 639-3 language codes?
    1. If no, shouldn't the documentation state that {{#language:<code>|en}} only supports ISO 639-1?
    2. If yes, where is the error and how does it get fixed?

Trappist the monk (talk) 19:09, 10 January 2015 (UTC)

1.1 no: The docu shouldn't say only, e.g., {{#language:tlh|en}} gives Klingon. Some ISO 639-3 three letter codes have older ISO 639-1 two letter codes. From the work on RFC 4646 (predecessor of RFC 5646) I recall that ar and zh were the worst cases. Check out section 2.2.2 in 5646 about "macrolanguage zh". Admittedly arb also doesn't work, maybe the logic is "support only the shortest code". –Be..anyone (talk) 07:28, 13 January 2015 (UTC)
I'm confused. We aren't talking about language sub-tags; the documentation for {{#language:<code>|en}} makes no mention of sub-tags. The documentation says that it "[returns the] full name of the language for the given language code" where 'language code' is vaguely defined as ISO 639-3. Because ara is a legitimate ISO 639-3 code (see at registration authority: ara) {{#language:ara|en}} should return Arabic which the language name assigned by the registration authority, shouldn't it?
Trappist the monk (talk) 14:01, 14 January 2015 (UTC)
ISO 639 macrolanguage != language, if there is a problem it would be arb, not ara. –Be..anyone (talk) 08:45, 15 January 2015 (UTC)

Missing magic word[edit source]

I just figured out that {{CURRENTMONTH1}} outputs the current month in a non-zero padded format (shown here: 10). The only problem is I am unsure of how to add it to the table without breaking the <translate> tags, as each one is numbered.

--KnightMiner (t/c) 03:33, 22 January 2015 (UTC)

  • I just added it without a number. Seems to render fine. — {{U|Technical 13}} (etc) 03:44, 22 January 2015 (UTC)

Failed to mark for translation[edit source]

Failed to mark the page for translation:

Function: MessageGroupStats::clearGroup
Error: 1205 Lock wait timeout exceeded; try restarting transaction (

— Preceding unsigned comment added by Shirayuki (talkcontribs)

EXPENSIVE tag[edit source]

What does it mean when a magic word is tagged as 'expensive' ([EXPENSIVE])? For example, the PAGESINCATEGORY magic word. In the description column, it says:

[Expensive] Number of pages (including subcategories and files) in the
given category. (Category:Help used for demonstration)

I had one thought of what the term 'expensive' means, which was that it ate up a lot of server memory? Or just in general, related to servers? Also, what makes some magic words 'expensive' and others not? Codyn329 (talk) 00:37, 12 March 2015 (UTC)

Check out Special:TrackingCategories and Category:Pages with too many expensive parser function calls, it's a tilt - game over effect. Articles MUST NOT be Turing Machines. Admittedly implementing the Ackermann function with templates is fun.smileBe..anyone (talk) 17:34, 13 March 2015 (UTC)

urlencode[edit source]

Is it possible to use this, to construct a link to an external webpage? An example would be greatly appreciated. --[[User:Bmrberlin| Bernd M.]] (talk) 11:26, 31 March 2015 (UTC)

There are three examples in the 2nd column of three, and there's a cheat sheet in the 3rd column: In essence urlencode always does the same thing, percent-encode Unicode, e.g., the input á u+00E1 is encoded as %C3%A1 for UTF-8 C3A1=C000+0300+0080+0021, with C=1100 for length two bytes, 3=0011 for some high bits, 8=10(00) for two bits indicating a tail byte, and 21=(00)10 0001 for six low bits. Putting hi+lo together that is (bits) 0011 10 0001 = (hex) E1 = u+00E1 as expected.
For the space character u+0020 you have to say what you want. Default or QUERY encodes spaces as + suited for, e.g., google queries. WIKI encodes spaces as _ as you would need it for a page#section_link. And PATH percent-encodes spaces as %20, suited for everything else, also known as URL-encoding. –Be..anyone (talk) 22:27, 31 March 2015 (UTC)

{{msgnw:xyz}} doesn't work with hidden comments[edit source]

I try to include the unexpanded wikitext of a page (this) into another page (this). I use {{msgnw:Namespace:Pagename}}, but I have a problem with hidden comments in the original page. Some are included, others aren't! Can you help me? Thanks in advance. --FRacco (talk) 11:14, 9 May 2015 (UTC)

The visible XML-comment is within a gallery. All other XML-comments never make it into msgnw. Something isn't as it should be, please report the bug. –Be..anyone (talk) 08:27, 9 July 2015 (UTC)

Help! I'm completely stumped![edit source]

Hi, I was wondering if anyone can help me out or at least point me in the right direction as to where I can solve this problem. I have imported some pages and templates into my wiki from Wikipedia but they are not displaying correctly. In all the inboxes I get a bunch of errors saying "mw:Help:Magic words#Other"

For the life of me, I can't figure out what the problem is.

Can anyone help me out please.


Here's a link:–_The_Ultimate_Cartoon_Adventure — Preceding unsigned comment added by Finalcutbob (talkcontribs)

The problem is one of the included templates of the page. See [1]. --Ciencia Al Poder (talk) 09:31, 2 June 2015 (UTC)

Thanks for your help!

Help for translation[edit source]

Hello, I recently made changes in this help page, but these changes are not transposed in the other languages. I guess this is related to the header saying "This page contains changes which are not marked for translation.", but I don't know how to mark my changes for translation. Anyone can tell me the way to do that? Best, Wikini (talk) 07:32, 5 June 2015 (UTC)

The message disappeared, I guess that someone made the changes needed. I again make changes in the English version and this message appears again. Best, Wikini (talk) 08:11, 9 June 2015 (UTC)

Behavior switch for auto-numbering section headings[edit source]

I suggest to create a new __NUMHEADINGS__ behavior switch to force auto-numbering the section headings. It would be useful in votes and polls, and in some structured pages. It should override individual user preferences in the page where it is included. Gustronico (talk) 02:19, 6 July 2015 (UTC)

Already filled on phabricator. --Ciencia Al Poder (talk) 19:05, 8 July 2015 (UTC)

PAGESINCATEGORY intersection[edit source]

Is there anyway to do a PAGESINCATEGORY intersection with the current magicwords? E.g., incategory:"puzzle video games" incategory:"rareware games" in the enwp search bar shows the intersection between the two categories. I'd like to easily calculate the number of hits for that intersection. – czar 20:53, 3 August 2015 (UTC)

{{PAGENAME: }} and {{filepath: }} don't work well together with apostrophe in filename[edit source]

{{filepath: {{PAGENAME: File:Our country's report.pdf}} }}

doesn't return a filepath, although filepath does with only the filename and {{PAGENAME: }} does return the right filename.--AdSvS 07:29, 6 August 2015 (UTC)

AdSvS seems to be saying that something should be returned but it returns blank:
  • {{filepath: {{PAGENAME: File:Our country's report.pdf}} }}
The first problem is that File:Our country's report.pdf doesn't exist, and {{filepath:}} always returns a null string for non-existent files. If we try the same thing using the name of a file that does exist, but contains no apostrophes, such as File:ChameleonSkin.png we get the expected result:
  • {{filepath: {{PAGENAME: File:ChameleonSkin.png}} }} → //
Trying a file which exists and also contains apostrophes, such as File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png, we get a null string:
  • {{filepath: {{PAGENAME: File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png}} }}
If we test each part separately, we see
  • {{PAGENAME: File:Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png}} → Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png
  • {{filepath: Chameleon VisualEditor 'Insert Media Dialog' Z Index Issue.png }} → //
i.e. it is something to do with the combination of the two functions. I think the actual problem is that {{PAGENAME:}} encodes certain characters, i.e. the apostrophe becomes the numeric entity &#x27;. --Redrose64 (talk; at English Wikipedia) 14:37, 6 August 2015 (UTC)
Thanks Redrose64 for the elaboration. That was indeed what I wanted to say and the filename was only an example. But your way is much, much better and I'll think about it when I run into strange things again! --AdSvS 15:51, 6 August 2015 (UTC)
And there's a bug for that! task T18474. This happens with other magic words as well. --Ciencia Al Poder (talk) 19:00, 9 August 2015 (UTC)