Help talk:Magic words/Archive 001

From mediawiki.org

Invoking tag without anonymous parameter

Hi, It look that invoking an XML-like extention with the #tag syntax but wihtout anonymous parameter is wrong. I made a test on the OpenStreetMap wiki (see [1]) with the folowing code

{{#tag:slippymap|lat=47.2553|lon=6.0121|z=12|w=300|h=550|format=jpeg}}

and I got errors. But the following code (with an empty anonymous parameter)

{{#tag:slippymap||lat=47.2553|lon=6.0121|z=12|w=300|h=550|format=jpeg}}

seems good (see [2]).

If the bug is from mediawiki, maybe it should be interresting to warn the users. FrViPofm 17:13, 31 August 2009 (UTC)Reply

Why do you consider it a bug?
{{#tag:tagname|content|parameter=value|more parameters}}</nowiki>
produces
<tagname parameter="value">content</tagname>
In your first example, you were sticking lat=47.2553 in as the content. Maybe it should be interesting to use it properly ^_^. Splarka 07:39, 1 September 2009 (UTC)Reply
Because the syntax N=X is widely used for passing named parameters, it is strange to find it as anonymous parameter, and IMHO it is not consistent with the use of templates where we can find templateName|N1=X1|N2=X2|Anon1|Anon2...FrViPofm 08:38, 1 September 2009 (UTC)Reply
Well, it isn't "anonymous", it is just that the first parameter after the name is aways the content for #tag. Your use case happens to require it to be blank. That isn't buggy. Splarka 07:04, 2 September 2009 (UTC)Reply

{{PAGESINCATEGORY:Beer}}

If I am not mistaken, this tag is no longer Expensive because of the schema changes made in 1.14 or 1.15. (Rob Church?)
If someone who knows better than I do agrees with my analysis, can you please remove that tag from the entry on this page?
Cheers!
--204.138.115.3 20:52, 3 September 2009 (UTC)Reply

Request regarding urlencode

The old version on urlencode replaced spaces with underscores, however, a relatively recent change means that it now replaces spaces with plus signs. There is at least one (and I assume several) applications in which it is still necessary to have the underscore: when converting a string for use at http://stats.grok.se, underscores are required instead of spaces.

Therefore, is it possible for someone to create a new magic word called urlencode2 (or something similar)? This could process the subject string through urlencode, then change any instances of "+" to "_". If this is not the right place to request something like this, please direct me elsewhere. Thanks! --Zach425 19:11, 9 September 2009 (UTC)Reply

Old version? relatively recent change? It looks like urlencode was introduced in rev:14273, only moved from Parser.php to CoreParserFunctions.php in rev:15276 where it has remained unchanged to this day. Where did you observe this change, Wikia perhaps? Splarka 07:10, 10 September 2009 (UTC)Reply
Followup: here is the Help page on meta just a few weeks after it was introduced: m:Help:Magic words#Namespaces and URLs. It shows {{urlencode: x y %@ }} producing +x+y+%25%40. Splarka 07:23, 10 September 2009 (UTC)Reply
You're absolutely correct - it seems I was MUCH mistaken regarding the "recent change". I'm sure I read that urlencode previously used an underscore instead of a plus sign (and its usage on Wikipedia suggests that this was indeed the case), but now I can't seem to find the site where I read that.
Urlencode aside, would it be possible to add rawurlencode as a magic word? I've found some documentation on it that indicates it would work for the problem stated above, as stats.grok.se accepts either _ or %20 in place of a space. Unfortunately, my very limited knowledge about PHP, Java, & MediaWiki doesn't allow me to act on what I've seen. Thanks again. --Zach425 08:43, 10 September 2009 (UTC)Reply
You can use the "escaped" version of the name-based magic words. For example: {{FULLPAGENAMEE}} produces "Help_talk:Magic_words/Archive_001", in a URL you can utilize it thusly: http://google.com/search?q=site%3Amediawiki.org+Help_talk%3AMagic_words%2FArchive_001 Splarka 13:26, 10 September 2009 (UTC)Reply
THANK YOU, Splarka! This is just what I needed, but I unfortunately didn't understand FULLPAGENAMEE well enough to realize it! --Zach425 04:35, 11 September 2009 (UTC)Reply

Using {{PAGESINCATEGORY}} in a nested parser function

Sorry if this is a known workaround. I was unable to find it easily if it does exist out there somewhere.

I was running into a bit of a snag using the following parser function to evaluate whether a category should show a category tree or not (strictly a stopgap measure) at the top of the page.:

{{#ifexpr:{{PAGESINCATEGORY:{{PAGENAME}}}}>100|{{#categorytree:{{PAGENAME}}|hideroot|showcount}}|}}

It seems that if there are more than 1000 pages in the category, {{PAGESINCATEGORY}} fails because a comma is inserted into the number and the expression cannot parse it as a numerical value. The workaround here is to use the {{#replace}} function:

{{#ifexpr:{{#replace:{{PAGESINCATEGORY:{{PAGENAME}}}}|,|}}>100|{{#categorytree:{{PAGENAME}}|hideroot|showcount}}|}}

RCWizard 23:12, 15 September 2009 (UTC)Reply

You can just use {{formatnum:~|R}}. That will also work on wikis set to a content language that delimits with periods, for example. Splarka 07:04, 16 September 2009 (UTC)Reply

Why not REVISIONTIME?

Why not {{{REVISIONTIME}}} ? --Dvdgmz 15:53, 8 October 2009 (UTC)Reply

PAGENAME, titleparts and categories

I'm trying to create a template that:

  • Auto-categorizes the including page
  • Sorts on the page name, but with a leading sub-page element stripped (e.g. "A/B/C" becomes "B/C")

What I have so far is something like:

<noinclude>[[Category: {{{catname|General}}} | {{{catsort|{{#titleparts: {{subst:PAGENAME}} | 0 | 2 }} }}} ]]</noinclude>

This fails because of the inclusion/substitution order, but for the life of me, I can't get the right ordering of <noinclude>...</noinclude> and subst: that works for this. Can someone help me out, here and either point me to somewhere that #titleparts is used with PAGENAME in a template or show me an example that's otherwise known to work? Thanks. -Harmil 20:48, 12 October 2009 (UTC)Reply

NUMBEROFACTIVEUSERS

Not much explanation on this - what is the definition of an active user? Based on number of edits / views? How recent? --Robinson Weijman 09:54, 10 November 2009 (UTC)Reply

/includes/SiteStats.php
$activeUsers = $dbr->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )',
	array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers' OR rc_log_type IS NULL" ),
	__METHOD__ );
It scrapes the recent changes table, so this depends on your Manual:$wgRCMaxAge setting. Splarka 08:23, 11 November 2009 (UTC)Reply
Thanks --Robinson Weijman 08:55, 22 January 2010 (UTC)Reply

Comment about reverted edit

Happy-melon reverted this component

§§ and also see that page for information about substitution (subst:) of these parser functions. §§

What I was trying to indicate is that if one wants to substitute Magic words that one needs to follow the link to get instructions on how to undertake the task as they are not contained on the this page. Billinghurst 11:24, 3 December 2009 (UTC)Reply

But that isn't where one should go to get those instructions; rather, one should look at Help:Substitution, which unfortunately hasn't yet been imported from meta. Happy‑melon 18:17, 3 December 2009 (UTC)Reply
That may be right, but it isn't being helpful. I find it interesting (read: hard to understand) that there is a level of purity that means that rather than link to a page that has information of relevance, it is better to have no link at all. If the page needs to be imported, rather than just revert a link, how about getting said page imported. Billinghurst 07:58, 5 December 2009 (UTC)Reply

DEFAULTSORT

Detail of sorting

(Reviving my unanswered question)

How does it sort pages that have the same sort key? PAGENAME? FULLPAGENAME? or something generally less useful, such as date of last edit? Robin Patterson 14:57, 21 July 2009 (UTC)

Robin Patterson 04:46, 1 January 2010 (UTC)Reply

{{CURRENTWEEK}}

Is it normal that {{CURRENTWEEK}} (17) displays the 53th week of 2009 when it's the 1st of 2010? JackPotte 19:32, 1 January 2010 (UTC)Reply

Yes, 2009 contain 53 weeks.Crochet.david 16:51, 3 January 2010 (UTC)Reply
So we should notify that {{CURRENTWEEK}} respects the rule to change the 2nd week following the 1/01, unless of it's a Monday? JackPotte 18:24, 3 January 2010 (UTC)Reply

Page name of transcluded page

Is there a way to automatically display the name of a page that has been transcluded into another page? If I use the {{FULLPAGENAME}} or {{PAGENAME}} magic words, I get the name of the page into which it has been transcluded. For example, if Example/subpage is transcluded into Example, they will show "Example", but what I want to display is "Example/subpage", so I can see what subpage is being used. Can this be done without hardcoding the name? RL0919 22:19, 23 February 2010 (UTC)Reply

No; you'll need to hardcode the name into the subtemplate to get it to stay static. Happy‑melon 23:39, 23 February 2010 (UTC)Reply
This JS code has been proposed as a gadget for that. JackPotte 21:57, 24 February 2010 (UTC)Reply

Page name: keeping only the main title of the sub-page name

Hello. Is it possible to discard one part between brackets from a sub-page name, keeping only the main title?
Example: keeping only “Foo” from “Title/Foo (bar)”
Thanks. 200.163.4.66 14:59, 2 March 2010 (UTC)Reply

Not really; you could hack something up with ParserFunctions and/or StringFunctions. Happy‑melon 23:12, 2 March 2010 (UTC)Reply
OK

tagname

Can this page link to some explanation of what "tagname" means in the #tag: function? Better yet, a specific example? Wnt 09:44, 4 March 2010 (UTC)Reply

PAGENAME for pages with underscore

The en:tz database contains identifiers containing an underscore. Templates, e.g.

store data to make it accessible via includes.

Works fine at

But not at

Any magic word that can deliver the name with underscores, as in the URL?

TimeCurrency 00:33, 13 March 2010 (UTC)Reply

Check the functions listed under Help:Magic words#URL data. Hamilton Abreu 01:32, 13 March 2010 (UTC)Reply
I see nothing that would output "America/Santa_Isabel". I also tried whether {{DISPLAYTITLE}} would return its value - it does not. TimeCurrency 14:50, 13 March 2010 (UTC)Reply
Misunderstood the question. Appending "E" to the magic word name should achieve the desired result:
{{PAGENAME:America/Santa Isabel}} → America/Santa Isabel
{{PAGENAMEE:America/Santa Isabel}} → America/Santa_Isabel
{{PAGENAME:America/Santa_Isabel}} → America/Santa Isabel
{{PAGENAMEE:America/Santa_Isabel}} → America/Santa_Isabel
Sorry about that. Hamilton Abreu 15:46, 13 March 2010 (UTC)Reply

Great news, thank you. Also thank you for giving the list here. In fact I was thinking about PAGENAMEE, but Help:Magic_words#Page_names says "URL-encoded" values, which is incorrect, details at en:URL encoding. But I don't with which words to correct this. TimeCurrency 02:39, 14 March 2010 (UTC)Reply

NUMBEROFACTIVEUSERS

Hi - can anyone tell me how NUMBEROFACTIVEUSERS (= 897) is defined? And can it be adjusted in e.g. LocalSettings? --Robinson Weijman 08:51, 15 March 2010 (UTC)Reply

From what can be gathered in Release notes/1.15, it "is like NUMBEROFUSERS, but uses the active users data from site_stats." Special:Statistics indicates that it is registered users who have performed an action in the last 30 days. Hamilton Abreu 13:50, 15 March 2010 (UTC)Reply
Aha, thanks Hamilton - very useful. --Robinson Weijman 12:53, 16 March 2010 (UTC)Reply

can someone get #tag to work with the include tags?

I know #tag is supposed to work for extension XML tags, but can someone add support for <noinclude>,<includeonce>,<onlyinclude>, and <nowiki>? Thanks. Manishearth 02:21, 20 March 2010 (UTC)Reply

Stuff inside a nowiki #tag is [[properly escaped]] (except template stuff) . noinclude etc aren't handled the same way as other XML tags. Happy‑melon 18:41, 20 March 2010 (UTC)Reply

CURRENTTIME family not affected by prefernces

No matter what I set my user preferences to, the CURRENTTIME family of magic words always seems to return UTC; both here and on my 1.15.1 local installation.

Is this a bug, a misdocumentation, or am I just doing it wrong? :) --WeaverThree 18:52, 23 March 2010 (UTC)Reply

Page content does not change based on user preferences like that. It would invalidate cache horribly. Splarka 07:54, 24 March 2010 (UTC)Reply
Yeah, I realized that after I went in there to see if I could "fix" it :). The only way it even seems possible would be if the parser left a marker in the output that say the skin code search-and-replaced with the proper value (since monobook.php appears to use user preference when adding the "last edited on" footer...?), and that just seems all kinds of messy-bad. Should the help just say "currenttime etc returns UTC time" then? --WeaverThree 12:47, 24 March 2010 (UTC)Reply

Big redundancy

This page and its translations are to my mind to merge with meta:Help:Magic_words. JackPotte 11:21, 25 April 2010 (UTC)Reply

Other way round. This is the master copy of the MediaWiki documentation (the one which will be kept up-to-date by the developers as the software changes); the content from meta should be merged here. Happy‑melon 16:19, 25 April 2010 (UTC)Reply
I agree but unfortunately I can't import them here with my user account and meta still hasn't got the same consensus. JackPotte 17:38, 25 April 2010 (UTC)Reply

(SOLVED) Username

Is there any magic word which would username of return currently logged user?

Or his IP adress? --88.102.135.201 15:21, 18 May 2010 (UTC)Reply

Check answer to Help_talk:Extension:ParserFunctions#Check Username Hamilton Abreu 15:56, 18 May 2010 (UTC)Reply
Well, that exactly what I didn't wanted. That writes name of who made last edit on such page, which is almost like signature. I need username of user who is just reading that page. --88.102.135.201 17:25, 18 May 2010 (UTC)Reply
...like for example for welcoming user by his name right on Main Page --88.102.135.201 17:48, 18 May 2010 (UTC)Reply
I was looking for a MediaWiki-function like this, but I was told that there is none. But hey, if you find it - please tell me. :-) May be there is an extension which provides the username of the visiting user. I didn't check this, because installing an extension is no option at the wiki I was working on. -- Oculus Spectatoris disputioe-mail 23:32, 18 May 2010 (UTC)Reply

I think I found PHP variable, which contains username, however I wasn't able to create own Magic Word (not even normal static text). If you help me, I might be able to advance it into Magic Word containing username.. --88.102.135.201 00:12, 19 May 2010 (UTC)Reply

So, using manual didn't helped me. However, I was able to tweak Extension:UserInfo and add this into it. However, it seems like these custom variables gets parsed and stored, as neither original variables or my experimantal one doesn't seem to react to logining as different user, change of browser... --88.102.135.201 01:23, 19 May 2010 (UTC)Reply
Moreover, there is Extension:WhatIsMyIP, which is not installed on this Wiki. JackPotte 04:59, 19 May 2010 (UTC)Reply
That might work, again I made it to show username. However, I cannot include special pages in other articles, including Main_Page, which means it doesn't really help. --88.102.135.201 09:15, 19 May 2010 (UTC)Reply

I guess I know, why it didn't worked. PHP variable from which my experiments are fetching username is probably processed after parsing of document, which means it might not be ok...--88.102.135.201 10:43, 19 May 2010 (UTC)Reply

This might be of no help either, but [[Special:MyPage]] → Special:MyPage takes you to the user's own user page. If you can figure out how that's done, therein might lie the answer. Hamilton Abreu 11:25, 19 May 2010 (UTC)Reply
Most promising would be that Extension:WhatIsMyIP, I already managed to make it display current username correctly. However, if I try to treat that Special page as template and include it on normal page, it doesnt work. Only page I was able to include was Special:AllPages
Thats probably closest solution so far, I only need to include it. --88.102.135.201 11:54, 19 May 2010 (UTC)Reply
Almost solved. class WhatIsMyIP extends SpecialPage { needed to be extended into class WhatIsMyIP extends IncludableSpecialPage { , now it almost works, username is correct, only thing I need is to get rid of line-breaks. --88.102.135.201 12:21, 19 May 2010 (UTC)Reply

Okay, it seems like it still needs some work: There is a problem with OutputPage.php.

I can sort of include it on page, but if I want something more like IF or use it as part of link or such things, its doesn't work... :-( --88.102.135.201 13:56, 19 May 2010 (UTC)Reply

Well, I finally managed to make it work. It took a bit of combining extensions, using magic words and special pages, molding it through styles and templates... but now I can process username with {{#ifeq:{{USERNAME}}}} or place it in link {{User:{{USERNAME}}}}. I tested it, any user I log in as different users, logged out.. tested from different computer.. process output with functions... fully working. If you are interested, I'll write a manual how to make it work. --88.102.135.201 11:24, 20 May 2010 (UTC)Reply
Congratulations! :-) But... If I understand your report correct, then the result of your hard work is an extension that needs to be installed - which means it is on the first hand available for "private" operated wikis? Then you could nominate it at usability.wikimedia.org>Wikipedia Usability Initiative>Environment Survey to get it to the Foundation wikis too. Or is it just handful of code to improve the Mediawiki-software? Then it might be a good idea to look directly at the Developer hub here on Mediawiki. I'd like to use it someday! -- Oculus Spectatoris disputioe-mail 15:20, 20 May 2010 (UTC)Reply

Currently it is just bunch of manually upgraded extensions working together, I will refine it into something better and upload it, but I already have lot of other work ahead, so it might take a while. --88.102.135.201 16:27, 20 May 2010 (UTC)Reply

List of Tables and Figures

  1. Is this the best place to ask for enhancements to Mediawiki magic words?
  2. Anyhow, could we please have __LOT__ and __LOF__ added for "list of tables" and "list of figures"? Maybe also __TOC+T__, __TOC+F__, __TOC+TF__ for ToCs with tables or figures or both included and __LOTF__ for a common list of tables and figures. Crissov 12:30, 5 July 2010 (UTC)Reply
No, this isn't the best place to ask for enhancements to Mediawiki magic words. The best place is mw:Project:Support_desk. When you edit this page you see a banner (the one that reads "Please do not post support questions here.") that tells you more about your options. ;-) Vale, Oculus Spectatoris disputioe-mail 13:42, 5 July 2010 (UTC)Reply
I saw that, but wasn't sure whether "support" covered enhancement request. — Christoph Päper 17:33, 5 July 2010 (UTC)Reply

PAGESINCATEGORY doesn't work on my site.

I cannot seem to get the PAGESINCATEGORY magic word to work. My wiki treats it like its a Template.
Is there a setting that needs to be set somewhere to make it work? My Wiki Version is 1.13.1
I note that it works here: {{PAGESINCATEGORY:Help}} = 141

I can't help with your issue, but just to note that {{PAGESINCATEGORY:Help}} = 141 is wrong as there are (at present) 61 pages and 1 category. Is there a parameter to tell this function not to include categories? NinjaKid 20:48, 31 July 2010 (UTC)Reply

DISPLAYTITLE

Something that isn't documented is the fact that {{DISPLAYTITLE}} works only in some namespaces (tested on 1.16.0).--188.109.252.74 12:06, 20 August 2010 (UTC)Reply

Creator

Is there a variable where it shows who made the first edit (creator) of a particular page? Rehman 02:39, 24 December 2010 (UTC)Reply

No, not at the moment in the core. Krinkle 13:16, 24 December 2010 (UTC)Reply

Uploader

Is there a magic-word/template where it shows the uploader of a particular file? This would be most helpful when dealing with files, especially on Commons. Rehman 10:38, 8 January 2011 (UTC)Reply

Transclusion

Please see

I tried clarifying the intro of Help:Magic Words.

"Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message. For example; {{FULLPAGENAME}} will always give the name of the page it is written on originally, even if displayed on other pages via transclusion."

I added the second sentence. The first sentence is really confusing. I am still not sure. Maybe Wikia is different. --Timeshifter 23:10, 26 January 2011 (UTC)Reply

Number of days in a month

Could you please let me know if we have a magic word gives number of days in a month? Example this month (May) have 31 days. Thank in advance!--Cheers! 02:03, 14 May 2011 (UTC)Reply

time of last revision

w:en:User:Omtay38/sandbox/Archive_10#Even_easier_than_that.21

Updated: {{ #time: F j, Y "at" G:i:s |{{REVISIONTIMESTAMP}} }}

Updated: August 31, 2020 at 13:50:43

Just granpa 02:45, 14 May 2011 (UTC)Reply

Getting the username

Is there any way to detect the username of the person looking at a given page, so you could have the code respond "Greetings, <username>" for example? This is a basic programming exercise, so I was surprised that there doesn't seem to be any documented way to do it with Mediawiki, unless I just haven't been looking in the right place.

Yes, I am looking for the same thing, but for multiple other reasons.. I am looking for some kind of {{Currentuser}}, I am also looking for some kind of {{NumberOfEdits|(user)}}
I'd like to be able to make a welcome template that uses something like:
== Welcome! ==
{{post|1=0|2={{<includeonly>subst:</includeonly>yoursig}}|3=
May I extend my warmest welcomes and offer you any help you may need? Thanks for your {{NumberOfEdits|{{CurrentUser}}}}
 {{plural:contribution|{{NumberOfEdits|{{CurrentUser}}||s}}, {{gender:{{CurrentUser}}|Mr.|Ms.|}} {{CurrentUser}}!

If you need help with something...
:...I'm always available! You can drop a message on [[User_talk:{{{1}}}|{{gender:{{{1}}}|Mr.|Ms.|}} {{{2|{{{1}}}}}}'s user
 talk page]] (which I watch like a hawk) or grab my other contact info on my [[User:{{{1}}}|{{gender:{{{1}}}|Mr.|Ms.|}}
 {{{2|{{{1}}}}}}'s user page]].
:...There's a wealth of wiki documentation on  the [[enter:Help:Contents|meta wiki]], perhaps some of it may be of use to you.
:...There's a really good '''[[enter:Introduction|Introduction]]''' over on meta also, it should help you figure out what's
 going on if your new to wikis in general.

I'd like to hear a reply! Just click '''Edit''' above, and write a message under where mine ends - then, at the end of your
 message (on the same line) type four tildes (Like this: {{4tildes}}) to automatically insert a nickname linked to your user
 page, and a date/time signature!

Again, welcome to the wiki - and I can't thank you enough on behalf of the community for your help in making us the best DDO
 site around {{face|wink}}}}
Which uses {{Welcome|(Login of sysop)|(display name of sysop if different)}}
Technical 13 19:09, 22 June 2011 (UTC)Reply

{{DISPLAYTITLE:title}} does not affect title shown while previewing

This confused me for a bit because I thought I was doing something wrong -- the {{DISPLAYTITLE:title}} magic word only changes the title that is shown when viewing a page, not when editing. It would probably be a good idea to indicate this in the documentation.

What I'm wondering is: are there any other magic words for which this is true but not obvious?

--Woozle 23:26, 23 June 2011 (UTC)Reply

{{PAGESINCATEGORY}} counts sub-categories

Is there anyway to count only pages in a category, rather than pages and sub-categories? Eladkse 16:49, 11 July 2011 (UTC)Reply

{{SERVERNOWIKI}}

To report the server without reporting it as a link the following template can be used :

{{#replace:{{SERVER}}|:|& #58;}} (remove space between "& #")

Useful for getting the server to be passed as a variable to java or object 188.222.137.154 10:36, 17 July 2011 (UTC)Reply

Default user for gender tag

The gender tag should be enhanced to enable using the current username when none is provided. Otherwise, this tag is quite useless.

--DavidL 12:49, 30 September 2011 (UTC)Reply

nowiki parameter in filepath

What is |nowiki parameter in {{filepath:}} supposed to do? Gustronico 16:33, 8 October 2011 (UTC)Reply

Magic Word to reference Section Header Name

Is there any possibility to get the header name of the section - like {{SECTIONNAME}} as you can show the article name with {{PAGENAME}}? I am pretty sure I would have stumbled upon it if it was as easy as just using a magic word for it, but I could not even find an extension that provides it. I can't believe noone was in need for this before... Can anyone point me to something? Thanks a lot --Achimbode 16:04, 13 October 2011 (UTC)Reply

Is magic variable expansion an atomic operation?

I cannot find it mentioned anywhere, hence the question: Is the expansion of mediawiki magic variables an atomic operation for the whole page? If so, is this "by accident/side-effect", or is MediaWiki deliberately coded to guarantee this under all circumstances (that is, also, if no caching is used)? I wonder, if the contents of variables could change during the time it takes to process a page.

To illustrate this, assume it would take some while to process a huge page containing a {{CURRENTTIME}} at the beginning and the end of the page. Will both magic variables be expanded to the same value, even if the second rolls over in the meantime?

The background to the question is the observation, that various Wikipedia templates use the {{CURRENTYEAR}}, {{CURRENTMONTH}}, {{CURRENTDAY}}, {{CURRENTTIME}} and similar MediaWiki variables to compose more complex date representations for a multitude of purposes. Example for a template to display the ISO 8601 date:

{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}

Now, if MediaWiki would not guarantee that all these variables do not change while the template is being processed, such a template would produce faulty output if executed in the very moment, when the month rolls over. In this moment, it could still output the old month (and year), but the new date. Example: If 2011-11-30 rolls over to 2011-12-01, the template might emit 2011-11-01 instead. If 2011-12-31 rolls over to 2012-01-01, the template might emit 2011-12-01 or 2011-01-01 instead.

It would be possible to create the same ISO 8601 output by processing the contents of the {{CURRENTTIMESTAMP}} variable instead, however, this is more complicated to code, and most of the existing templates to do take this route. So, do all these templates just work "by accident" (since the rollover is a relatively rare event) or does the MediaWiki variable expansion takes care of this by design? Thanks. --88.77.205.254 18:16, 7 November 2011 (UTC)Reply

All of them are replaced with the same timestamp, provided by ParserOptions::getTimestamp(), so there won't be such rollover effect. Platonides 18:50, 7 November 2011 (UTC)Reply
Thank you for the quick answer. --84.63.108.166 19:54, 7 November 2011 (UTC)Reply

nowiki parameter in filepath

What is nowiki parameter in {{filepath:}} supposed to do? Given examples don't show any difference:

  • {{filepath:Wiki.png}} → //upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png
  • {{filepath:Wiki.png|nowiki}} → //upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png

Gustronico 15:30, 17 November 2011 (UTC)Reply

They look the same because of the configuration used on Wikimedia sites. These examples should make it more clear what the nowiki parameter does:
As you can see, nowiki prevents the automatic linking of the returned URL. But on Wikimedia filepath returns a protocol-relative URL, which are not automatically linked anyway. Thus, the result is the same. Reach Out to the Truth 19:38, 17 November 2011 (UTC)Reply
Thank you. There is no info about this parameter in the help page. I think it should be named nolink instead. Gustronico 19:59, 18 November 2011 (UTC)Reply
Automatic url linking is not a wiki markup related feature, but a general web practice instead, so "nowiki" make no sense here. It should be better named "nolink". Gustronico 16:23, 19 November 2011 (UTC)Reply

ProtectionLevel prior to 1.15

I am currently investigating a wikia site to see what needs to be done. Caveat is they have 1.13.2 (r1) and the ProtectionLevel magic word wasn't implemented till 1.15.

How do i either create the template PROTECTIONLEVEL that returns the similar results or can substitute the MagicKeyword with an equivalent operation?

I know this is taking a huge step backwards but is what i have to work with.

Thank you in advance Goldbishop 03:00, 21 January 2012 (UTC)Reply

Is there some reason why an upgrade has not been done? The PHP version is < 5.1 perhaps. Try typing Special:Version into the search bar and let us know. Allen4names 05:13, 21 January 2012 (UTC)Reply
Its not mine to upgrade, just mine to deal with as i am sharing developement responsibility.
If it was mine to administer solely or immediately, i would upgrade by all means.
Since it is not, i need to incorporate a mechanism that will handle this feature since the Magic Word wasnt implemented.
Goldbishop 14:01, 21 January 2012 (UTC)Reply
If you have Extension:Parser Functions installed a modified version of wikipedia:Template:After should do the trick. In any case please contact whoever has system administrator privileges and ask that an upgrade be performed. Allen4names 16:52, 21 January 2012 (UTC)Reply

possibility like {{USERNAME}}

is there a variable or possibility for showing the own username (every logged in person should see your own name)?

Not without an extension (There are several that do this). This would break caching (because every user would have to see a different version of the page) so it's not happening in core mediawiki. Bawolff 15:28, 13 February 2012 (UTC)Reply
Can someone link me to one of these extensions?

interface language

is there a function or possibility for showing the own user-interface-language (every person should see your own interface language)?

Sort of. {{int: is per interface lang, and some folks (Commons in particular) have made things like commons:template:autotranslate out of that. Bawolff 15:29, 13 February 2012 (UTC)Reply
Thank you! With that describtion, it works perfect :-) Mediawikitester 11:54, 14 February 2012 (UTC)Reply

Is there a {{USERLANG}} function similar to {{CONTENTLANG}}?

I have an external link that I want to post on my wiki that I know will be used internationally and I want to be able to have the link not default to en. This link (http://www.google.com/#hl=en&q=free+mmo+guild+hosting&pf=p&output=search) I wanted to make it read http://www.google.com/#hl={{USERLANG}}&q=free+mmo+guild+hosting&pf=p&output=search instead of assuming everyone comprehends "en". Can this be done? -- Technical 13 (talk) 00:18, 25 March 2012 (UTC)Reply

It's possible with Extension:Translate (no, you can't use it on Wikipedia), see also m:Help:System_message#Branching_based_on_the_user_language. In your example, just remove the hl=en part and let Google guess the language of the user (they'll surely know better). --Nemo 11:41, 25 March 2012 (UTC)Reply

Is there a way to get the post-expand {{PAGESIZE:page name}}?

I have a page on the wiki I'm a sysop of that is pushing a post-expand size of 1.25MB (Monster Information/All) that I want to keep an eye on on my user page. However, this is a tiny page in of itself being build as an transclusion of 21 or so other pages. Is the only way for me to do it to build an {{#expr:{{PAGESIZE:main page name}}+{{PAGESIZE:first transclude page name}}+{{PAGESIZE:second transclude page name}}+{{PAGESIZE:...}}+{{PAGESIZE:last transclude page name}}}}??? -- Technical 13 (talk) 15:45, 10 April 2012 (UTC)Reply

Update: I put together the "(~{{formatnum:{{#expr:ceil({{#expr:{{PAGESIZE:Monster_Information/All|R}}+{{PAGESIZE:Monster_Information/Header1|R}}+{{PAGESIZE:Monster_Information/1|R}}+{{PAGESIZE:Monster_Information/2|R}}+{{PAGESIZE:...|R}}+{{PAGESIZE:Monster_Information/20|R}}}}/1024)}}|,|3}}kB)" which only reports 1/5 of the page size because it still doesn't include the multiple uses of each template per page.. So that work-around doesn't even work.. Anyone have a suggestion? -- Technical 13 (talk) 15:58, 10 April 2012 (UTC)Reply
Bug 35908 created -- Technical 13 (talk) 12:29, 12 April 2012 (UTC)Reply
And closed "invalid". If you get an answer, please post it here. Rd232 (talk) 09:45, 23 April 2012 (UTC)Reply
Then re-opened as a feature request and an importance change from normal to enhancement. -- ShoeMaker   ( Contributions • Message )   19:23, 25 April 2012 (UTC)Reply

__NOEDITSECTION__ work in 1.18.3?

hi, i update mediawiki from 1.18.1 to 1.18.3, and __NOEDITSECTION__ not work in my wiki. (this closed wiki, i dont show link)--Pastakhov (talk) 17:18, 27 April 2012 (UTC)Reply

Without being able to see your wiki, I'm not sure how to help you. If you could make a demo of the problem, that would help a lot, especially if you need to report it as a bug. Badon (talk) 04:25, 28 April 2012 (UTC)Reply

magic word for current url/page

Is there a magic word that can be used for a global header so that it grabs the current page or url for any given page?

Using {{fullurl:{{FULLPAGENAME}}}} on this page will render as //www.mediawiki.org/wiki/Help_talk:Magic_words. Allen4names (talk) 04:01, 28 May 2012 (UTC)Reply
I'm currently using that. But I have my global header setup through the Sitenotice, so that the links always go back to Sitenotice rather than the current page a user is on. Thank you for responding to me! :)

__NEWSECTIONLINK__ or {{NUMBEROFARTICLES}} alternative in 1.6.10?

is there any alternative to __NEWSECTIONLINK__ or {{NUMBEROFARTICLES}} in 1.6.10?

doubtful. Rd232 (talk) 17:31, 9 July 2012 (UTC)Reply

{{NUMBEROFVIEWS}}

Q/ {{NUMBEROFVIEWS}} doesn't work on my wiki. You'v got any idea ?

A/ Needs MW 1.14++

signed for archiving purposes. Rd232 (talk) 01:08, 24 June 2012 (UTC)Reply

TOC - hide contents

is there a possibility to hide the content at starting up the page? i saw that it is made with a nice little java script.

probably possible, but not without some coding. Try the Project:Support desk the question should have been directed to in the first place. Rd232 (talk) 17:30, 9 July 2012 (UTC)Reply

Full list?

I'm sure I saw something like __no-rich-editor__ around this website.

I can't find that. It must be provided by one of the Category:WYSIWYG extensions. Rd232 (talk) 17:30, 9 July 2012 (UTC)Reply

anchorencode bug?

HTML anchors must begin with an alphabet character to be valid - they should be of the pattern [A-Za-z][A-Za-z0-9:_.-]*. Shouldn't {{anchorencode: ensure this? ¡¡gracefool☺ 00:26, 24 June 2012 (UTC)Reply

disable rich editor on part of page

Is it possible to use __noricheditor__ only on part of page? (like paragraph?)

No, behaviour switch magic words apply to the entire page. Rd232 (talk) 17:30, 9 July 2012 (UTC)Reply

Section counter

Is there (or is there a plan to include) a magic word for current section number, usable for example in an edit link like [{{fullurl:{{FULLPAGENAME}}|action=edit&section={{CURRENTSECTION}}}} edit this section]? Is this feasible to implement? Kephir (talk) 12:08, 16 August 2012 (UTC)Reply

Template name rather than page name

Is there way to insert the name of the template rather than that of the page it is being transcuded into? Ivan Pozdeev (talk) 19:39, 24 September 2012 (UTC)Reply

No Line

Is there any magic word to remove the horizontal lines which locate after each heading? --Yoosef Pooranvary (talk) 00:13, 9 August 2012 (UTC)Reply

There is no magic word for such a thing. That is handled by the skin's css, which you may change if you have access to the skins and your intent is to remove them for everyone. If you do not have access or do not want to remove them for everyone, you may add a section of code to your User.css to remove them. You will simply add something like:
h1, h2, h3, h4, h5, load.php @media screen h6{border-bottom: 0;}
I hope this helps you. -- ShoeMaker   ( Contributions • Message )   12:44, 15 February 2013 (UTC)Reply

Scope of NOEDITSECTION not clear

In the documentation it is suggested that NOEDITSECTION may work on one section only. My experience however is that if you put one NOEDITSECTION on a page all sections are non editable. I would prefer it possible to select which sections are editable and which not, but I see no way how to do this. Is there a way to do this? --AdSvS (talk) 13:34, 3 October 2012 (UTC)Reply

Padleft with spaces

How do you force padding with spaces? I've tried &nbsp; and <span> tags, but they only pad one character and stop.

Not sure exactly what you are hoping to do, but have you tried &#32;? Might even require a combination of an alternation of padding with &nbsp;&#32; Also, I'm thinking it is another possibility that the parser is parsing it out more than once and you should maybe try <nowiki> </nowiki> -- ShoeMaker   ( Contributions • Message )   18:59, 18 February 2013 (UTC)Reply

Case Manipulation

Is there currently any method available to format a string with w:Start Case? I know there is {{uc: to transform string to upper case, {{lc: to transform string to lower case, {{ucfirst: to transform first character to upper case, and {{lcfirst: to transform first character to upper case. What I am looking for is something like {{sc: to transform a string into start case (This Is Start Case Style). If there is currently nothing, I'll put in a feature request on Bugzilla, I just figured I would ask here first. -- ShoeMaker   ( Contributions • Message )   19:10, 13 February 2013 (UTC)Reply

Pending change level

This page needs to be updated with {{PENDINGCHANGELEVEL}}, but I'm not sure that I could describe it accurately myself. Does anyone know who the right person to ask is? Mr. Stradivarius (talk) 10:17, 15 February 2013 (UTC)Reply

First off, what is a {{PENDINGCHANGELEVEL}}? I've tried searching the text for anywhere on this wiki and en.wikipedia and can't find a thing referring to that. It looks like some kind of Magic Word or Template, but I can't find it on the Help:Magic Words page or in the Template namespace.
Secondly, what is the change that you think condones a {{PENDINGCHANGELEVEL}}?
-- ShoeMaker   ( Contributions • Message )   19:15, 18 February 2013 (UTC)Reply
PENDINGCHANGELEVEL is a magic word that shows the level of pending-changes protection active on the current page. It's already implemented, it's just not documented here yet - I revised a meta-template for protection icons using it on en.wiki (en:Template:Pp-meta). On the template talk page, someone pointed to this page where it was apparently put into MediaWiki, but I don't really understand the code review process or localization issues, so I thought I'd ask before adding it to the page in case I got it wrong. Best --Mr. Stradivarius (talk) 03:01, 28 March 2013 (UTC)Reply
Does that magic word belong to the core (or core set of extensions)? I would think it is part of Extension:FlaggedRevs' Special:PendingChanges. No? Either way, I don't see this MAG listed on Special:Version with the rest of the MAGs. — T13   ( C • M • Click to learn how to view this signature as intended ) 10:34, 28 March 2013 (UTC)Reply
It's extension specific so probably belongs on in the extension docs. Note afaik special:version only lists parser functions not variables and this one is a variable. Bawolff (talk) 11:31, 28 March 2013 (UTC)Reply
Wouldn't it be in the same group as ... numberofedits, numberoffiles, numberofpages, numberofusers, numberofviews, padleft, padright, pagename, pagenamee, pagesincategory, pagesize, plural, protectionlevel, ... ? Technical 13 (talk) 12:06, 28 April 2013 (UTC)Reply

Option NOSEP in formatnum

What does it do? See translatewiki:Thread:Support/Magic_Word_"NOSEP". --Nemo 21:24, 29 March 2013 (UTC)Reply

Reading numbers from titles

Hi. Could anybody help me how to read only numbers from titles with different parametres (e.g. the title is "1256 something" and the template should extract only "1256"; or the title is "something 358 something" and the template should extract only "358")? I tried it by using different magic words, but they appeared to be useless in this case. I'd also like to know if it's possible to create a template that will read the words from the title in a given order (e.g. the title is "Canis Minor" and the template should read only the second word, i.e. "Minor"). Thanks.--Kiril Simeonovski (talk) 07:48, 8 April 2013 (UTC)Reply

Replied here: Thread:Project:Support desk/Reading numbers from titles --Ciencia Al Poder (talk) 09:35, 8 April 2013 (UTC)Reply

{{PAGESINCAT:Foo|subpages}}

Is there an easy way to get the total number of subpages in a category such as {{PAGESINCAT:Foo|subpages}}? This would be useful for keeping track of members of maintenance categories that are segregated by month or year. Technical 13 (talk) 15:44, 22 May 2013 (UTC)Reply

No, and this could be a highly expensive parser function. --Ciencia Al Poder (talk) 09:12, 23 May 2013 (UTC)Reply

Getting display on the page without parsing: mw:Help:Magic words#Other

Hi,

I have mediawiki 1.23 and most of the extension installed, including scribunto, parserfunctions...

Since, the august dump I am getting errors in the page like the page is not able to parser Magic words module. Do you have any idea why is that happening?

Most of the pages are broken.

... 

Gaius Marius colspan=2 style="background-color: lavender; text-align: center" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Consul of the Roman Republic

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-



  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.colspan=2 style="border-bottom:none; text-align:center"#REDIRECTmw:Help:Magic words#Other This page is a soft redirect.In office 107 BC, 104–100 BC, 1 January 86 – 13 January 86 BC #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-








style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Preceded by

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Marcus Aurelius Scaurus #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Succeeded by

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Quintus Servilius Caepio and Gaius Atilius Serranus #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-


  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-












  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-

colspan=2 style="background-color: lavender; text-align: center" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Personal details

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Born

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. ca. 157 BC Arpinum, Roman Republic #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Died

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. January 13, 86 BC (aged 70) Rome, Roman Republic #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Political party

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. populares #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-

style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Spouse(s)

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Julia (paternal aunt of Julius Caesar) #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Children

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Young Marius #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-



style="text-align:left;" #REDIRECTmw:Help:Magic words#Other This page is a soft redirect. Religion

  1. REDIRECTmw:Help:Magic words#Other

This page is a soft redirect. Roman Paganism #REDIRECTmw:Help:Magic words#Other This page is a soft redirect.-


Please consider revising your topic by removing unnecessary white-space and adding content under a registered account so that someone could actually respond back to you directly if they preferred.
--Erutan409 (talk) 13:06, 21 October 2014 (UTC)Reply