Help talk:Magic words/Archive 1
![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 |
For heavens sake, just what is meant by Magic word???
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
I sometimes wonder if the computer gurus on Wikipedia know how to speak English!! This article lists jillions of Magic words, but nowhere does it explain what a Magic word is. Please, someone, explain what a Magic word is and do so in plain English that a non-computer guru can understand. If it can be exemplified, give some examples ... also in plain English. - mbeychok 18:41, 26 December 2006 (UTC)
- It is a word that gives the software a specific task to do, such as display the current date, hide the TOC, etc. inline with the text. ffm yes? 22:30, 21 February 2007 (UTC)
- I have copied the latest version from meta that makes that clear. Jon513 13:54, 22 February 2007 (UTC)
- I've added it to the glossary. Libcub (talk) 21:52, 25 February 2008 (UTC)
Defaultsort and talk pages
![](http://upload.wikimedia.org/wikipedia/en/thumb/b/ba/Red_x.svg/20px-Red_x.svg.png)
I left the same question at META, hope to get a reply or fix for this at one place or another...
Is there a reason that the talk pages for articles that have a defaultsort don't "follow" the same sorting? Or, is thre a way to get the talk pages to follow the sorting for the article? For example, the article A Chinese Ghost Story II sorts as "Chinese Ghost Story II, A" but the talk page sorts as Talk:A Chinese Ghost Story II. Is there a need to put a defaultsort on the talk pages too? Hope not! By the by, I noticed this at [1]. SkierRMH 07:52, 6 March 2007 (UTC)
Page view
Is there a magic word to show how many times a page was viewed or accessed? - RyanGibsonStewart (talk) 13:34, 24 August 2007 (UTC)
H:Page name variables
Since all the magic words are listed here is there really a need for H:Page name variables? -Rocket000 20:53, 8 September 2007 (UTC)
Tag extensions
Is there a list of all tag extensions / xml-style tags (such as <math>, <ref> or <source>) that are supported in the Wikipedia MediaWiki installation? --Abdull (talk) 14:35, 9 December 2007 (UTC)
- Special:Version, scroll down to #Parser extension tags ∴ AlexSm 21:44, 9 December 2007 (UTC)
WP:Magic disambig
Would it be possible to have a note at the top of the page mentioning about how WP:MAGIC redirects here and you may be looking for Wikipedia:WikiProject Magic? This is in the same way that WP:NOTE mentions about citations, footnotes and what wikipedia isn't. It is a plausible redirect I believe, as the other day I couldn't remember the page name so typed WP:MAGIC in search and ended up here instead. Thanks! StephenBuxton (talk) 09:26, 22 May 2008 (UTC)
Incorrect links
Searching through here, there are a number of links that aren't quite right, namely the $wg...
links. They all link to something along the lines of http://www.mediawiki.org/wiki/Help:$wg..., but it should be .../wiki/Manual:$wg.... For example, the link to $wgVersion
is http://www.mediawiki.org/wiki/Help:$wgVersion, but it should be http://www.mediawiki.org/wiki/Manual:$wgVersion (the difference is "Help:" in the first link and "Manual:" in the second). Shouldn't this be fixed? Omega234 (talk) 19:04, 8 June 2008 (UTC)
- Fixed, thanks. JackSchmidt (talk) 03:23, 9 June 2008 (UTC)
Page Names: How can I get the base page name for a subpage?
I am trying to get the magic word that will do the following. Let's say I have page:
TOPPAGE/SUBPAGE
I want the magic word that would bring back just TOPPAGE. It doesn't seem to exist in the documentation. —Preceding unsigned comment added by 76.110.234.160 (talk) 22:41, 28 June 2008 (UTC)
- BASEPAGENAME doesn't do it? Saintrain (talk) 20:51, 6 August 2008 (UTC)
- BASEPAGENAME only removes one subpage level, (e. g. [2], check the "Benutzerseite" link). Something like TOPPAGENAME would be useful when a template may appear at deeper subpage levels. Paradoctor (talk) 09:59, 4 October 2009 (UTC)
- Yes that would be useful. Headbomb {ταλκκοντριβς – WP Physics} 05:57, 22 October 2009 (UTC)
- BASEPAGENAME only removes one subpage level, (e. g. [2], check the "Benutzerseite" link). Something like TOPPAGENAME would be useful when a template may appear at deeper subpage levels. Paradoctor (talk) 09:59, 4 October 2009 (UTC)
Not really a magic word, but you could use a parser function (#titleparts) to acheieve this effect:
This function separates a pagetitle into segments based on slashes, then returns some of those segments as output.
{{#titleparts: pagename | number of segments to return | first segment to return }}
If the number of segments
parameter is not specified, it defaults to "0", which returns all the segments. If the first segment
parameter is not specified or is "0", it defaults to "1":
{{#titleparts: Talk:Foo/bar/baz/quok }}
→ Talk:Foo/bar/baz/quok{{#titleparts: Talk:Foo/bar/baz/quok | 1 }}
→ Talk:Foo{{#titleparts: Talk:Foo/bar/baz/quok | 2 }}
→ Talk:Foo/bar{{#titleparts: Talk:Foo/bar/baz/quok | 2 | 2 }}
→ bar/baz
For this and more, see the info posted on MediWiki about this. Hope that helps! Avicennasis @ 20:52, 14 April 2010 (UTC)
subst with MWs
Hi! Is there a way to get the functionality of {{subst:PAGESINCATEGORY:cat}}? Thanks. Saintrain (talk) 20:20, 6 August 2008 (UTC)
- Yes! Same syntax. I must have tyoped. Saintrain (talk) 16:42, 7 August 2008 (UTC)
Raising alarms
Where is the table showing the codes to use to raise an alarm, i.e. "This article needs to be expanded on in general", or "this article needs a photo", etc. And yeah, I DO need a response. --Ragemanchoo (talk) 05:47, 19 August 2008 (UTC)
- Excuse me? You catch more flies with honey than vinegar. Toddst1 (talk) 17:36, 20 August 2008 (UTC)
- I've found people on the site to be relatively unresponsive. --Ragemanchoo (talk) 08:11, 21 August 2008 (UTC)
- Incorrect, Toddst1, you catch flies more effectively with vinegar. This guy didn't get a reply in about 5 years, so he was right about the fact that nobody replies to anything. 96.46.194.11 (talk) 17:47, 8 October 2013 (UTC)
Magic word for current user name
Isn't there a magic word for the current user name?—Largo Plazo (talk) 18:25, 16 October 2008 (UTC)
- apparently not89.34.111.9 (talk) —Preceding undated comment was added at 21:56, 10 November 2008 (UTC).
- Why isn't there any, is there any specific reason for that? If not, I suggest that it is implemented. —Kri (talk) 23:30, 1 July 2011 (UTC)
- I'm bumping this section! —Kri (talk) 23:33, 1 July 2011 (UTC)
- Please don't, per Wikipedia:Talk page guidelines#Technical and format standards the threads should be in chronological order of first creation.
- Such a change is not one which can be incorporated in Wikipedia without an underlying change to the MediaWiki software. You'll need to raise a WP:BUGZILLA ticket, unless you can find an existing one. --Redrose64 (talk) 00:28, 2 July 2011 (UTC)
- I'm bumping this section! —Kri (talk) 23:33, 1 July 2011 (UTC)
- Ok, won't happen again. At least not until I've raised a WP:BUGZILLA ticket ;)
- By the way, I think the template Currentuser does what we're looking for, the correct usage should be
{{subst:Currentuser}}
if you want the username to stick. —Kri (talk) 01:22, 2 July 2011 (UTC)- It depends upon how you want to use it. Using
{{subst:currentuser}}
is exactly equivalent to using{{subst:REVISIONUSER}}
. It follows that this is the name of the person who added that text, and not the name of the person currently viewing the page, which is what I believe the original poster was asking for. So, if you want to create an automatic personalised message which changes for each person viewing it, it's not presently possible. --Redrose64 (talk) 11:22, 2 July 2011 (UTC)
- It depends upon how you want to use it. Using
- By the way, I think the template Currentuser does what we're looking for, the correct usage should be
- Okay, if you want the name of the person that is viewing the text, since currentuser apparently has to be substituted, I guess
{{REVISIONUSER}}
is the thing you want to use? Test: Lowercase sigmabot III —Kri (talk) 12:22, 2 July 2011 (UTC)
- Okay, if you want the name of the person that is viewing the text, since currentuser apparently has to be substituted, I guess
- There isn't a magic word for the username of the user currently viewing the page because that would destroy the caching and overload the servers, and it's completely useless except for novelty on user pages (i.e. "Hi, VisitorName! Welcome to my user page!"). Anomie⚔ 15:00, 2 July 2011 (UTC)
- I disagree: First, it wouldn't do anything to the cache, as you can see when you're viewing a page, your username is already present if you're logged in. Secondly, I was looking to create polls for the wiki on my site and this would be useful to have. That's just one example, there's far more than novelty involved. — Preceding unsigned comment added by SinisterRainbow (talk • contribs) 07:14, 3 February 2012 (UTC)
- You are wrong about the cache. There are multiple levels of cache employed on Wikipedia, and these are designed so that the different skins, headers, and user scripting included on the page are handled as efficiently as possible while the rendered content of the page is the same (as much as possible).
- As for the wiki on your site, this page is the wrong place to discuss it. This page is about the English Wikipedia. And there is probably already an extension you can install on your own wiki to do what you want. Anomie⚔ 12:12, 3 February 2012 (UTC)
- I disagree: First, it wouldn't do anything to the cache, as you can see when you're viewing a page, your username is already present if you're logged in. Secondly, I was looking to create polls for the wiki on my site and this would be useful to have. That's just one example, there's far more than novelty involved. — Preceding unsigned comment added by SinisterRainbow (talk • contribs) 07:14, 3 February 2012 (UTC)
- The article text is rendered completely differently from the header/footer that shows your current login name, and the bulk of the header is not cached, whereas the article text is. For example, the header can vary wildly by user based on what templates are included. As a workaround in your particular case, you could add some javascript into the header, that did a javascript search and replace on the article text looking for a particular magic word, and replace it. This would obviously only work for users that have javascript enabled, and may have some performance (on the client) impacts. Gaijin42 (talk) 03:16, 20 March 2012 (UTC)
{{fact}}
I knew what I wanted to insert but I could not remember the magic word for it at the time. I have since found it by checking the source of the article I am editing - the magic word being {{fact}}. Personally I would have expected to find it under the "Wiki markup" section in the drop-down below the editor but for some reason it isn't included there nor is it in the "magic words" article. Is this magic word hidden on purpose from users or what? -Andreas Toth (talk) 00:19, 17 December 2008 (UTC)
- {{fact}} is a template, not a magic word. —Lowellian (reply) 22:14, 21 May 2010 (UTC)
substituing REVISIONID
Hi! Is there a way to get the functionality of {{subst:REVISIONID}}? It doesn't work! Thanks. Gustronico (talk) 23:04, 10 March 2009 (UTC)
PAGENAME: piping works
Hi,
I researched & checked (sandbox) that the Magic Word PAGENAME does take piping as expected in this situation:
{{Wikisource1913CatholicEnc|Congo|MyPipeName}}
See (graphic-->):
![](http://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/38px-Wikisource-logo.svg.png)
Worth adding to the Help? (Systematically then, does this work for more (pipeable) Magic Words?). Bye, -DePiep (talk) 13:06, 10 April 2009 (UTC)
How may additional magic words be requests or created?
There are some additional ones I'd like, but I don't know where to find the information on how to do it or where/who to ask. Шизомби (talk) 16:48, 19 December 2009 (UTC)
- It's rare that new magic words do get added; what is it that you need? There may already be some equivalent already in existence. --Redrose64 (talk) 17:23, 19 December 2009 (UTC)
- The technical village pump (WP:VPT), or bugzilla, is probably a place to ask (though it's quite unlikely that anyone will do anything about your request with any speed, or at all).--Kotniski (talk) 11:40, 20 December 2009 (UTC)
Magic Word for article sections?
I wondered if there were magic words similar to {{PAGENAME}} which created the accordant name of the n-th article section (given that it exists), something like {{HEADERNAME1}}, {{HEADERNAME2}}, etc. - If you wonder why i'm asking: i planned to make a TOC with adapted formatting (custom background color, round edges, "Article sections" instead of "Contents") 87.177.180.170 (talk) 23:03, 25 December 2009 (UTC)
- I rather think that a non-standard TOC would be strongly discouraged. --Redrose64 (talk) 17:05, 26 December 2009 (UTC)
Magic Word for removing a page from a category?
I think that I came across this before (how to link to a category but not actually list said article in the category), I am trying to create a template (in my own wiki project) which will both create a box at the top of the page saying it was flagged for deletion and list the page on Template:Delete. I've finished both the template and category, which can be found here. If I could get at least a "this is not possible, get people to [[Category:Delete]] on the page as well as the template," it would be greatly appreciated. Metalmiser (talk) 08:37, 8 March 2010 (UTC)
- To link to a category without putting the current page into the category, put a colon before the word Category, for example: [[:Category:Cities]].--Kotniski (talk) 09:03, 8 March 2010 (UTC)
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
Anyway to replace spaces with underscore?
TimeCurrency (talk) 00:25, 13 March 2010 (UTC)
- Have you tried the magic word urlencode?--Kotniski (talk) 09:17, 13 March 2010 (UTC)
- Try editing Template:Infobox tz to replace
{{PAGENAME}}
with{{PAGENAMEE}}
, which is the URL-encoded equivalent. — Richardguk (talk) 15:20, 13 March 2010 (UTC)
- Try editing Template:Infobox tz to replace
But they make both +, not _, instead of spaces. How could I make a link with underscores and special characters? 193.71.127.134 (talk) 18:26, 24 May 2010 (UTC)
- "
{{PAGENAMEE:America/Santa_Isabel}}
" (and "{{PAGENAMEE:America/Santa Isabel}}
" too) produces "America/Santa_Isabel", with an underscore. America/Santa_Isabel looks OK to me; what exactly is the problem? — Richardguk (talk) 21:15, 24 May 2010 (UTC)
TOC-related Magic Words
NOTOC and TOC in User Space?
Is __NOTOC__ and __TOC__ supposed to work in Userspace? Avicennasis @ 20:52, 14 April 2010 (UTC)
- I don't see why not. Do you have an example where they don't work?--Kotniski (talk) 05:57, 15 April 2010 (UTC)
Yep. I want to suppress the TOC on my todo list, and it isn't working. User:Avicennasis/todo. :-/ Avicennasis @ 21:17, 15 April 2010 (UTC)- Nevermind. Turns out one of the templates I was transcluding had it built in. >.> I fixed it. Avicennasis @ 21:29, 15 April 2010 (UTC)
Magic Word to Autohide TOC
I have seen wiki pages in the past that opened with an automatically hidden TOC with the Show button next to it... I cannot find them now. Can anyone tell me how this is done?
Nerdvana (talk) 22:14, 8 October 2010 (UTC)
- Not a magic word, but a template -
{{TOChidden}}
. --Redrose64 (talk) 15:41, 9 October 2010 (UTC)- Excellent. Is that a part of MediaWiki or will I need to ask the admin of the wiki I'm working in to port that over? --Nerdvana (talk) 16:41, 9 October 2010 (UTC)
- It's a template, therefore is not part of the MediaWiki standard installation. Since it's a template, if it doesn't already exist on the relevant Wikipedia language, you should be able to create it. AFAIK it's only on two other languages: id:Templat:TOChidden and pl:Szablon:Spis treści zwinięty although I'm suspicious about the Polish one. --Redrose64 (talk) 17:59, 9 October 2010 (UTC)
- Excellent. Is that a part of MediaWiki or will I need to ask the admin of the wiki I'm working in to port that over? --Nerdvana (talk) 16:41, 9 October 2010 (UTC)
Suggestion {{{n}}}
Add {{{value}}} magic word. SWFlash
- Please clarify your request. First: why? Second: what will it do? Third: why would it have triple braces? Triple braces are normally for template parameters; magic words usually use double braces. --Redrose64 (talk) 20:17, 30 November 2010 (UTC)
Where is #tag documentation
I couldn't find #tag listed in the table along with #if, #ifeq, etc. Where is it documented? —Preceding unsigned comment added by 64.129.229.106 (talk) 23:30, 8 December 2010 (UTC)
- mw:Help:Magic words, as mentioned at the top of the help page. Anomie⚔ 02:11, 9 December 2010 (UTC)
unpadding
I'm looking for a template that will eliminate padding (ie the negation of padleft/padright). I'm working on an extension to template:binary for decimals, and I keep running across this issue. Any help (even how to search for such a thing) would be greatly appreciated. VIWS talk 05:37, 21 July 2011 (UTC)
I made it work without, but I'd still like to know if there is such a thing, and if not, put it on someone's list. VIWS talk 09:22, 25 July 2011 (UTC)
NOEDITSECTION
__NOEDITSECTION__ doesn't seem to be working, see Portal:Contents for example. Has it been disabled ? Mattg82 (talk) 18:20, 14 December 2011 (UTC)
- I see it was also mentioned on Village pump. Also see T33445 and T33647, they say resolved but still doesn't seem to be working. Mattg82 (talk) 18:47, 14 December 2011 (UTC)
String Functions
Why don't the mw:Extension:StringFunctions, e.g. {{#len:string}} work here?
Jim Craigie (talk) 06:35, 17 December 2011 (UTC)
- Because they're not enabled on this wiki. See the third "Note:" box. --Redrose64 (talk) 14:03, 17 December 2011 (UTC)
- Well, thank you, but how can I get them enabled here?? Unless I've misunderstood, LocalSettings.php doesn't appear to be something that I can change myself.
- Jim Craigie (talk) 22:05, 17 December 2011 (UTC)
- You can't. See T28092. The sysadmins are opposed to enabling anything less than some sort of full scripting language (that doesn't use double- and triple-braces all over the place). Anomie⚔ 04:08, 18 December 2011 (UTC)
- Jim Craigie (talk) 22:05, 17 December 2011 (UTC)
- Thank you for the link to T28092. You have lead me to a battle in T8455 that appears to have been going on in a hidden backwater for five years!! – its very hard to understand. If there is a consensus to add a full scripting language that is not obvious, nor are the timescales for its availability. Even if there is such a consensus and imminent availability, a scripting language would be much harder for non-programmers to use. This looks like perfection being the enemy of good. Surely no one can believe that the current string function hacks are better than activating mw:Extension:StringFunctions. Shouldn't there be a more mainstream location for discussing this? I'm clearly not alone in thinking this.
- I am trying to create a template to make URLs for an external site which requires each non-alphanumeric character to be replaced by an underscore, and {{#replace:}} seems to be what I need. I don't want to get embroilled in a protracted battle, so should I just give up trying to improve Wikipedia?
- Jim Craigie (talk) 02:22, 20 December 2011 (UTC)
- Your best bet is probably to just document that "non-alphanumeric characters must be replaced by an underscore" in the template's documentation. This old VPT thread has a summary of the situation as of mid-2009. At the moment the contender for the "real scripting language" may be mw:Extension:WikiScripts. Anomie⚔ 04:10, 20 December 2011 (UTC)
- Jim Craigie (talk) 02:22, 20 December 2011 (UTC)
No Line
Is there any magic word to remove the horizontal lines which locate after each heading? --Yoosef (talk) 08:20, 9 August 2012 (UTC)
- No, but you can add the following line to either Special:MyPage/common.css or Special:MyPage/skin.css:
h2 { border-bottom: none; }
- This will remove the horizontal line below section headings (those formatted as
==Heading==
). To remove the horizontal line below page headings as well, useh1, h2
instead ofh2
. --Redrose64 (talk) 14:52, 9 August 2012 (UTC)
A quirk
Hi all,
- Over at Wikipedia:Copyright problems there's a section which contains "Wikipedia's current date is {{CURRENTMONTHNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}...". However, those magic words don't seem to take effect; I just see it rendered as "Wikipedia's current date is CURRENTMONTHNAME CURRENTDAY, CURRENTYEAR. I tried editing the section; after a punctuation tweak it seemd to work in Preview, but on saving the change they're still redlinks. I know that these magic words are used elsewhere successfully (a lot of portals have boxes of "On 05 October..." type content). What's going on? Am I missing something obvious? There are lots of other templates on the affected page so maybe the parser has indigestion? If so, perhaps we should document that weakness more clearly as I couldn't find anything.
- On a related point: Should this help page explain the distinction between magic words and templates, even though both can be invoked with double braces? For instance, if there was a template with the same name as a magic word, presumably it couldn't be invoked in the usual way..? (Whilst trying to figure out what was happening on Wikipedia:Copyright problems I found that there were templates like {{CURRENTMONTHNAME}} which got deleted years ago - they all seem to have been attempts at template vandalism).
Any suggestions? bobrayner (talk) 22:38, 5 October 2012 (UTC)
- The magic words and links at Wikipedia:Copyright problems#Footer are not being processed because the mediawiki processing limits have been exceeded. (If your preferences display hidden categories, you can see that the page has automatically been categorised in Category:Pages where template include size is exceeded.) The cure for this is to remove or "
subst:
" unchanging templates in the preceding sections. - According to mw:Help:Magic words#Variables, if a template clashes with a magic word, the magic word is used and template is ignored. (This can be overridden by specifying "
Template:
" before the template name, but the inevitable confusion makes it better to avoid any duplicate names).
- The magic words and links at Wikipedia:Copyright problems#Footer are not being processed because the mediawiki processing limits have been exceeded. (If your preferences display hidden categories, you can see that the page has automatically been categorised in Category:Pages where template include size is exceeded.) The cure for this is to remove or "
- — Richardguk (talk) 23:23, 5 October 2012 (UTC)
- Groovy; thanks. bobrayner (talk) 01:32, 6 October 2012 (UTC)
Arithmetic operators with magic words
Sorry if this is a stupid question, but I want to be able to use something other than UTC in my sig file, yet I don't want it necessarily to be the time of my computer (I think there's a COMPUTERTIME magic word -- I don't want that). How do I use a math. operator with CURRENTTIME?
Something like the following is what I want to be able to do, but where adding 1 actually works. :)
{{subst:CURRENTTIME+1}} (Berlin Time)
Thanks.
BWP1234 (talk) 11:57, 25 November 2012 (UTC)
- Using the help page here, I constructed
{{subst:#time:H:i, j F Y|now +1 hour}}
which displays as "13:12, 25 November 2012". BUT I'm not convinced this is a good idea, as it will make it hard for other editors to compare your timestamps with those of other editors. -- John of Reading (talk) 12:12, 25 November 2012 (UTC)
Thanks for the quick reply! I'll reflect on the effect on other users before implementing this. (Another ?: Why on earth doesn't Wikimedia default to the ISO date format?= BWP1234 (talk) 12:39, 25 November 2012 (UTC)
- For the same reason that it's discouraged at WP:DATESNO - it's not the natural way of writing dates. --Redrose64 (talk) 14:16, 25 November 2012 (UTC)
- Thanks for the answer, though I (weakly) disagree that it's not the "natural" way of writing dates, but, more importantly, strongly disagree that whatever's natural should be determinate. --User:BWP1234 (talk) 2012-11-25, 14:46 (New York Time)
- There are a number of scripts and bots that expect that dates and times will be written in a particular format. If you try to deviate from that format, stuff like this happens. --Redrose64 (talk) 23:44, 25 November 2012 (UTC)
- Let's hope someone soon realizes that badly written bots need to be scrapped, or rewritten! --User:BWP1234 (talk) 2012-11-26, 02:37 (New York Time)
- Bots are coded to implement an agreed standard. You are welcome to start a discussion about changing the standard to allow for varying time zones, but I, for one, would favour consistency. -- John of Reading (talk) 08:19, 26 November 2012 (UTC)
- Myself, I favor diversity, and everything that enables diversity to flower! --User:BWP1234 (talk) 2012-11-26, 07:44 (New York Time)
- I sympathise with your point that the ISO format would be more logical, but you've even departed from that by using a local timezone instead of UTC.
- More importantly, the adopted signature format has been chosen because it is the single most commonly used and recognised unambiguous international English-language format. So it is not an arbitrary choice. And dozens of bots rely on this standard being followed. In particular, Wikipedia:Signatures indicates that non-standard timestamps can confuse bots which automatically archive sections according the date of the most recent comment.
- You are free to propose a new format, but until community consensus adopts your proposal, the onus is on you to respect the agreed guidelines – or create a more diverse wiki on your own website and edit there instead!
- — Richardguk (talk) 13:27, 26 November 2012 (UTC)
- Here is an example of an ISO format date being wrongly interpreted. There are two possibilities: (i) the person who added the ref had assumed that the format should be CCYY-DD-MM and 158.169.131.14 has applied the correct fix for that; (ii) the person who added the ref had used the format CCYY-MM-DD, but 158.169.131.14 has assumed that it was formatted CCYY-DD-MM and applied the incorrect "fix". In fact it was the latter. This sort of issue will always arise unless we insist upon months being written out as words. --Redrose64 (talk) 13:53, 27 November 2012 (UTC)
- Redrose64: I wouldn't mind writing out the month, but the year should come first: biggest units to smallest units (seconds).
- As for this: "The adopted signature format has been chosen because it is the single most commonly used and recognized unambiguous international English-language format."
- I'm not sure I agree, though I may misunderstand. Though I probably disagree no matter what you mean. Is "international English" a compound noun, modified by the preceding adjectives? If so, I disagree with the application of the adjectives, but mostly with the very idea that there is something that should be regarded as "international English" (though there probably should be some kind of international English -- it would certainly help nonnative speakers!) 2) If "international" is one of the adjectives, then ISO is probably more widely recognized -- or recognizable --(though perhaps not yet most widely used).
- If a condition of my participation here is that I have to conform to a standard I disagree with, I may bow out. Anyway, thanks for the explanations. --User:BWP1234 (talk) 2012-11-27, 12:56 (New York Time)
- Myself, I favor diversity, and everything that enables diversity to flower! --User:BWP1234 (talk) 2012-11-26, 07:44 (New York Time)
- Bots are coded to implement an agreed standard. You are welcome to start a discussion about changing the standard to allow for varying time zones, but I, for one, would favour consistency. -- John of Reading (talk) 08:19, 26 November 2012 (UTC)
- Let's hope someone soon realizes that badly written bots need to be scrapped, or rewritten! --User:BWP1234 (talk) 2012-11-26, 02:37 (New York Time)
- There are a number of scripts and bots that expect that dates and times will be written in a particular format. If you try to deviate from that format, stuff like this happens. --Redrose64 (talk) 23:44, 25 November 2012 (UTC)
- Thanks for the answer, though I (weakly) disagree that it's not the "natural" way of writing dates, but, more importantly, strongly disagree that whatever's natural should be determinate. --User:BWP1234 (talk) 2012-11-25, 14:46 (New York Time)
Help with magic words in a template
Hello, i'm a member of WP:MMA a wikiproject for Mixed Martial Arts. We have been experiencing some troubles with pages being marked for deletion in part because they lack good sources. I thought it might help to build a template that could be dropped in a talk page that would help people find sources. the problem is that the pages in question have spaces in their names, example being UFC 49, the space breaks the external link so the template ends up useless. the magic word i'm using is {{BASEPAGENAME}}, i've tried {{BASEPAGENAMEE}} which replaces the space with an underscore, that makes the link work, but breaks the google search, so again it doen't actually work for what i want it to. When i use the template I've created in a page with no spaces it looks and works great. Anyway, the template i made is {{MMA find sources}}, if you click on that you will see it broken, or you can check out my sandbox (the same template, but my sandbox title doesn't have spaces) to see how i hoped it would look and work. Any help is much appreciated! Kevlar (talk) 09:19, 5 December 2012 (UTC)
- The template {{Find sources}} uses "urlencode" to get round this, so I suggest you adapt the coding from there. -- John of Reading (talk) 11:20, 5 December 2012 (UTC)
- (edit conflict) Probably redundant now that John has pointed you to {{Find sources}}, but in case it's of further help:
- Wrap the page name in
{{urlencode:...}}
to convert spaces to pluses (which Google will convert back to spaces). For example, "{{urlencode:{{BASEPAGENAME}}}}
" produces "Magic+words". - Note that
{{BASEPAGENAME}}
risks removing any part of the article name after a slash (for example, "A/B testing" would produce "A"). On the other hand,{{PAGENAME}}
risks including extraneous subpages if it is transcluded on talk subpages (such as archive pages). If you will only ever use the template on the main article talk pages, "{{urlencode:{{PAGENAME}}}}
" would be most appropriate. - — Richardguk (talk) 11:27, 5 December 2012 (UTC)
- thanks very much! you guys both rock! Kevlar (talk) 21:05, 5 December 2012 (UTC)
Scope of basic search
I wonder where it is possible to learn where the scope of basic search, or Advanced search by selected namespaces, is extended beyond the page as rendered by my webbrowser.
Specifically regarding magic words, by accident I learned that basic search for 'FORCETOC' (or 'FORCETOC_' and others) hits 543 articles. Initially I supposed that those are all of the English wikipedia articles that use the magic word, and visiting some may be instructive.
Soon I lost that faith, finding 2 hits for BASEPAGENAME and none for NEWEDITSECTION.
Similarly --for two that are not magic words but likely to be confused, if i understand correctly-- 216 hits for DEFAULTSORT (in article space, not the redirect to help space) and 1 hit for TOCLIMIT.
Now I wonder whether these searches hit mistaken appearances in article code, which are relatively few in number and may have diagnostic value because something needs to be fixed --instructive value as illustrations only in the negative, so to speak.
--P64 (talk) 03:36, 14 February 2013 (UTC)
Ignore parts of a string for ifeq/switch-conditions
I have a number of strings that are entered in templates that contain 3 letters followed by 3 digits, for example "ISS064" or "STS123". Is there a way to make a compare or ifeq comparison to find out whether the beginning of the string is "ISS" or "STS" without making a comparison between the string and all possible numbers behind them?
Example how it's done now:
{{#ifeq: {{#switch: {{{mission}}} | ISS001 = ISS | ISS002 = ISS | ISS003 = ISS | ... | ISS049 = ISS | ISS050 = ISS | Other }}| ISS | 1 | 2 }}
That, however, is getting slightly annoying for several hundred cases. Any help would be greatly appreciated. Thanks. --Julian H. (talk) 16:42, 23 March 2013 (UTC)
- You can pick out the first three characters using {{str left}}. Try something like...
{{#ifeq: {{str left|{{{mission}}}|3}} | ISS | 1 | 2 }}
- -- John of Reading (talk) 16:58, 23 March 2013 (UTC)
- Thank you very much, that is indeed much easier. --Julian H. (talk) 17:43, 23 March 2013 (UTC)
DISAMBIG
Could someone please add the necessary documentation for __DISAMBIG__ (mw:Extension:Disambiguator)? Thank you. -- Michael Bednarek (talk) 13:51, 11 July 2013 (UTC)
Done, see here --Redrose64 (talk) 14:30, 11 July 2013 (UTC)
Tomorrow
Is there some way to auto-generate text that is tomorrows date? Context: Wikipedia:Redirects for discussion/Today transcludes today's RfD discussions, but the page would be a million times better if it included a link to the previous day's discussions. Ego White Tray (talk) 03:07, 13 June 2014 (UTC)
- @Ego White Tray: Yes, the #time magic word can do this. The documentation is at mw:Help:Extension:ParserFunctions#.23time.
*[[Wikipedia:Redirects for discussion/Log/{{CURRENTYEAR}} {{CURRENTMONTHNAME}} {{CURRENTDAY}}]] *[[Wikipedia:Redirects for discussion/Log/{{#time:Y F j|now - 1 day}}]] *[[Wikipedia:Redirects for discussion/Log/{{#time:Y F j|now + 1 day}}]]
- Wikipedia:Redirects for discussion/Log/2024 August 21
- Wikipedia:Redirects for discussion/Log/2024 August 20
- Wikipedia:Redirects for discussion/Log/2024 August 22
Three "behavior switches" that aren't
Regarding the following three keywords:
{{DISPLAYTITLE|title}}
{{DEFAULTSORT|sortkey}}
{{noexternallanglinks}}
All three of these are presently included in the list of behavior switches, but they aren't behavior switches; the first two are variables, and the third is a parser function. It seems to me that they should be moved from the "Behavior switches" section to the "Variables" and "Parser functions" sections, respectively. — Jaydiem (talk) 00:18, 17 July 2014 (UTC)
- The first two do not return a value: they are not variables. The third does not take a value, process it and return another value: it is not a parser function. All three change the behaviour of the page: they are behaviour switches. --Redrose64 (talk) 00:27, 17 July 2014 (UTC)
- If you examine the linked references I provided above—or the "General information" section within the article itself—I believe you will find them to be incompatible with that interpretation. — Jaydiem (talk) 01:22, 17 July 2014 (UTC)
- It's an inconsistency within the page. I have raised the matter at mw:Help talk:Magic words#Variables that affect behaviour. Please do not use bullets for indenting talk page posts: see WP:TPG#Layout (third bullet) and WP:TPO#fixformat. --Redrose64 (talk) 10:21, 17 July 2014 (UTC)
- Thanks. When I noticed the discrepancy between how these three keywords are characterized here versus in the MediaWiki documentation, I thought I should point it out. I grant that all three affect page display, and thus behave differently from other variables and parser functions, but the MediaWiki categorization of keywords appears to key on their format and mechanism of action rather than on their effects. ~ Regarding indentation, over time I've developed the habit of including a bullet before the first paragraph of replies, and only colons before subsequent paragraphs of the same reply, as I find that this greatly improves readability. If it's good for threaded discussions in AfD, CfD, RfC, etc., then it's good elsewhere. But I'll defer to your request here. — Jaydiem (talk) 13:51, 17 July 2014 (UTC)
- It's an inconsistency within the page. I have raised the matter at mw:Help talk:Magic words#Variables that affect behaviour. Please do not use bullets for indenting talk page posts: see WP:TPG#Layout (third bullet) and WP:TPO#fixformat. --Redrose64 (talk) 10:21, 17 July 2014 (UTC)
- If you examine the linked references I provided above—or the "General information" section within the article itself—I believe you will find them to be incompatible with that interpretation. — Jaydiem (talk) 01:22, 17 July 2014 (UTC)
Pagename
I'd like to have WP:PAGENAME for WP:Page name.
Please let me know why I should not do that. I will be happy to reason further if need be. Thanks. — CpiralCpiral 04:18, 7 August 2014 (UTC)
- (i) because it's got incoming links, possibly some from edit summaries as well; (ii) because it's an established shortcut which has been around for over 6+1⁄2 years; (iii) because this is the wrong venue: repurposing of existing redirects (incl. shortcuts) is a WP:RFD matter. --Redrose64 (talk) 11:48, 7 August 2014 (UTC)
- I know it's asking a lot, but I think it's constructive for newer editors, so I'll go to Redirects for Discussion. Thanks for the direction. — CpiralCpiral 23:01, 7 August 2014 (UTC)
Per Wikipedia:Rfd#The_guiding_principles_of_RfD
RfD is not the place to resolve most editorial disputes. If you think a redirect should be targeted at a different article, discuss it on the talk pages of the current target article and/or the proposed target article. However, for more difficult cases, this page can be a centralized discussion place for resolving tough debates about where redirects point.
I realize it is a difficult thing to ask established and productive editors to change what was a learned habit. I assume this is going to be difficult, so I posted there. However I just noticed it says "for resolving debates". If I could get more admins and editors like Redrose to champion WP:Page name by using that terminology and modifying more pages to use that terminology, I'd gladly give up a redirect. But it doesn't have to be a battle. It only has to be a civil debate with a week long window, and we all conclude what is rational and reasonable. Right? — CpiralCpiral 07:29, 8 August 2014 (UTC)
Basically, what I posted there:
- WP:Page name has no redirect to its title.
- wp:pagename is the obvious choice for it.
- help:pagename already works for Help:Page name, the sister page of WP:Page name.
- The Project version of Page name is an important page (in theory) for Project improvement because it provides a concise terminology currently lacking on many project pages. Its is mature and stable. — CpiralCpiral 07:29, 8 August 2014 (UTC)
To respond to your reasons for keeping it:
- Project improvement implies "for the future" and "for new admins". What's more important, the changing of a 6+1⁄2 yr old habit of an established coder, or the sense of new admins who can type either help:pagename or wp:pagename to get to Help and Project sister pages?
- help:pagename is almost 6.5 yrs old. It is has been pointing to the same place for all its life: to the top of the page Help:Page name.
- Your current redirect for wp:pagename pointed to the top of the page Magic words for several years before it was used to redirect to Variables.
- For some, like me, but not others, there is an important distinction between the Help and Project namespaces concerning content. Your use of Project:pagename says its in the Help namespace.
- I will of course gladly modify all the incoming links necessary to point to wp:var instead of WP:Page name, if we re-reference wp:pagename, although I can't fix edit summaries, or get search results for talk page history. — CpiralCpiral 07:29, 8 August 2014 (UTC)
A fitting compromise was found:
- WP:Pagename --> WP:Page name, and wp:pagename navigates there
Done
- WP:PAGENAME --> WP:Magic words#Variables, and wp:PAGENAME goes there
Done— CpiralCpiral 20:34, 9 August 2014 (UTC)
Magic word redirect under discussion
Wikipedia:Redirects for discussion/Log/2014 September 8#Template:Revisionuser Oiyarbepsy (talk) 20:16, 8 September 2014 (UTC)
Magic words for episode number
Is anyone able to create a template or magic word template for season and episode numbers modelled on the time and date variables like {{CURRENTYEAR}}, {{CURRENTMONTHNAME}}, {{CURRENTDAYNAME}} and {{CURRENTDATE}}? -- PK2 (talk) 14:34, 26 September 2015 (UTC)
- @PK2: No. CURRENTYEAR etc. are real values that have an actual meaning, such as 2024. Season and episode numbers are abstracts, they have no true meaning. --Redrose64 (talk) 20:01, 26 September 2015 (UTC)
- Ok, because those magic templates would decrease the total number of edits that people would make on Wikipedia. So what can I and other users do instead? -- PK2 (talk) 05:37, 27 September 2015 (UTC)
- I don't understand why "those magic templates would decrease the total number of edits that people would make". I also don't understand what you are asking for. To introduce a new magic word, we first need to establish what it would do, where it would be used, and above all, why it is necessary. --Redrose64 (talk) 14:41, 27 September 2015 (UTC)
- Ok, because those magic templates would decrease the total number of edits that people would make on Wikipedia. So what can I and other users do instead? -- PK2 (talk) 05:37, 27 September 2015 (UTC)
Unknown extension tag "noinclude"
Hello !
I wanted to find a way to insert a noinclude tag inside page using a template.
So, I tried the "tag" magic word, but it didn't work.
e.g. I wanted to do something like : Template:Documentation_Template : {{#tag:noinclude|WRITE YOUR DOCUMENTATION HERE}}
So users creating a template could just use {{Documentation_Template}} and it would be interpreted as :
<noinclude>WRITE YOUR DOCUMENTATION HERE</noinclude>
Is there a way to do that ?
Thanks ! Taiko3615 (talk) 01:51, 23 January 2016 (UTC)
Silly me. I found what I was looking for. It's called Meta Templating : Help:Metatemplating Hope this helps others. Taiko3615 (talk) 02:07, 23 January 2016 (UTC)
Current user?
Is there a magic word that will show the name of the logged-in user viewing the page? That is, if I view the page, I see Oiyarbepsy, but if Example views the page, they see Example, but if 1.2.3.4 sees the page they see 1.2.3.4? This would be very useful in template examples that require entering your username. Oiyarbepsy (talk) 06:39, 11 February 2016 (UTC)
- @Oiyarbepsy: No, there isn't. I think this is a deliberate choice, because the software would have to re-think the HTML version of the page whenever anyone viewed it. -- John of Reading (talk) 07:06, 11 February 2016 (UTC)
STATICREDIRECT
STATICREDIRECT was added by this 3 October 2012 edit. I am wondering whether that magic word is active on this Wiki. The documentation says:
"Prevents the link on a redirection page from being updated automatically when the page to which it redirects is moved (and "Update any redirects that point to the original title" is selected). Also instructs interwiki bots to treat the page as if an article."
I don't recall ever seeing a checkbox for "Update any redirects that point to the original title" in the move-page dialog.
mw:Help:Magic words says:
"On redirect pages, don't allow MediaWiki to automatically update the link when someone moves a page and checks "Update any redirects that point to the original title" (which requires $wgFixDoubleRedirects)."
$wgFixDoubleRedirects says:
"Tends to conflict with page move vandalism, use only on a private wiki."
So does __STATICREDIRECT__ actually serve any purpose on English WIkipedia? wbm1058 (talk) 00:18, 27 April 2016 (UTC)
Wikipedia:Wikipedia Signpost/2008-07-28/Technology report:
- New features 28 July, 2008
- Double redirects (redirects which redirect to another redirect) created by new pagemoves are now fixed automatically by the software; edits made by such fixing are attributed to User:Redirect fixer, which operates much like a bot (although as a software feature, it only has bot abilities when operated by the MediaWiki software and no special powers when operated by anyone else), in that it works by making edits and does not operate instantly (but rather when it gets round to fixing the redirect). See this message for more details. (Note that the feature has changed slightly since that message; in order to prevent a double redirect being fixed, you now need to place __STATICREDIRECT__ on the double redirect page). (r37928, bug 4578)
Redirect fixer was disabled in rev:41716, 6 October 2008
Wikipedia:VisualEditor/Updates/20 March 2014
- Newsletter 20 March, 2014
- The page options menu (three bars, next to the Cancel button) has expanded. You can create and edit redirect pages, set page options like
__STATICREDIRECT__
,__[NO]INDEX__
and__
[NO]NEWEDITSECTION__
, and more.
Wonderful. VisualEditors can now spam (vandalize?) English Wikipedia with STATICREDIRECT graffitti. They had to add this feature, in case VE were ever used to edit a private wiki. They have no respect for our local setting of $wgFixDoubleRedirects, which leaves this feature turned off. Groan.
See Wikipedia:Double redirects for bots which fix double redirects. wbm1058 (talk) 20:21, 3 May 2016 (UTC)
Using AutoWikiBrowser, I made a list of Pages with a page property (based on Special:PagesWithProp) staticredirect
, and found just 164 pages on English Wikipedia with this property:
- 116 in main (article) space
- 34 in User: namespace
- 14 in Wikipedia: namespace
I don't really see any pattern in this very light amount of usage here, so it appears to me that there is no special use or purpose for __STATICREDIRECT__
on English Wikipedia. – wbm1058 (talk) 15:05, 5 May 2016 (UTC)
NUMBEROFVIEWS
The magic word "NUMBEROFVIEWS" (called here: {{NUMBEROFVIEWS}}) is listed on this page, but it does not appear to work. It shows up on Special:WantedTemplates and does not seem to work in any of the pages that call it. What am I missing? – Jonesey95 (talk) 17:56, 5 October 2016 (UTC)
- Further research: it was reportedly based on the value of page.page_counter, which has been disabled. – Jonesey95 (talk) 17:59, 5 October 2016 (UTC)
{{LOCALMONTH}}
{{LOCALMONTH}}, and the other {{LOCAL...}} magic words seem to give GMT based time/date instead of local time/date. I am not sure if local should really be local, or that of the specific server, but it seems that the server I use is in my time zone. Gah4 (talk) 10:17, 9 November 2016 (UTC)
- It's not GMT-based, but UTC based. Local in this context means the local time as defined for the entire wiki; for the English Wikipedia, local time is set to UTC. --Redrose64 (talk) 11:40, 9 November 2016 (UTC)
Number of edits for a user
Anyone know if there's currently a way to display an individual user's edit count through template means? {{NUMBEROFEDITS:User:Test}} doesn't work. -- Ϫ 08:09, 12 July 2019 (UTC)
- No, there isn't. --Redrose64 🌹 (talk) 11:39, 12 July 2019 (UTC)
- Hmm, I seem to recall seeing some userboxes that display edit counts but those are probably updated by the users themselves. Thanks for responding Redrose64. -- Ϫ 04:45, 28 July 2019 (UTC)
- Yes, at User:Redrose64#totaledits there is a userbox presently showing "This user has made more than 201,000 contributions to Wikipedia", this is indirectly driven by Template:Adminstats/Redrose64, which is bot-updated at least once per day. Unfortunately, if you're not an admin you can't make use of this feature. Note that only that first figure is dynamic, the others are manually updated and at least four years out of date. --Redrose64 🌹 (talk) 12:35, 28 July 2019 (UTC)
- Hmm, I seem to recall seeing some userboxes that display edit counts but those are probably updated by the users themselves. Thanks for responding Redrose64. -- Ϫ 04:45, 28 July 2019 (UTC)
SHORTDESC
There is no documentation on this page for the SHORTDESC magic word. — Preceding unsigned comment added by MoonyTheDwarf (talk • contribs) 16:59, 6 October 2019 (UTC)
- @MoonyTheDwarf: Maybe because it doesn't exist. It's certainly doing nothing in your post. --Redrose64 🌹 (talk) 22:40, 6 October 2019 (UTC)
- @Redrose64: It exists, but should never be used directly. See Wikipedia:Short description#Implementation. -- John of Reading (talk) 02:46, 7 October 2019 (UTC)
- Oh, they mean
{{SHORTDESC: }}
. The braces and colon are significant: not all magic words use them. --Redrose64 🌹 (talk) 08:21, 7 October 2019 (UTC)
- Oh, they mean
- @Redrose64: It exists, but should never be used directly. See Wikipedia:Short description#Implementation. -- John of Reading (talk) 02:46, 7 October 2019 (UTC)
Inconsistency
At Help:Magic words/Archive 1#General information:
- The first parameter's syntax differs. In {{#magic: p1| p2 | p3}}, the name is #magic and it will be followed by an unspaced : colon and a required input parameter, p1. The first
|p1=
of a template is optional but would be preceded by a | pipe instead of a : colon.
This seems inconsistent. The second sentence says p1 is mandatory, but the third says it's optional and would apparently be called as {{#magic|p1=...}}
? —[AlanM1(talk)]— 08:11, 27 March 2019 (UTC)
- @AlanM1: The second sentence is describing a parameter passed to a magic word. The third sentence is describing a parameter passed to a template. This is part of a section trying to compare magic words and templates. -- John of Reading (talk) 09:04, 27 March 2019 (UTC)
- (late response) Doh! Just didn't see that. —[AlanM1(talk)]— 01:01, 4 December 2019 (UTC)
__NOGLOBAL__
I cannot see __NOGLOBAL__ as magic word. [3]. --BoldLuis (talk) 14:13, 12 May 2020 (UTC)
- Reading the gerrit that you provided, I think that it's not going to be useful here - it's mainly of use at meta:. But it is documented - in a fashion - at mw:Help:Magic words. --Redrose64 🌹 (talk) 17:28, 12 May 2020 (UTC)
ParserFunctions extension not working here
The article says:
Further information: mw:Help:Magic words § Parser functions, and mw:Help:Extension:ParserFunctions
and
This page is a quick reference for magic words. For more information, refer to the main MediaWiki documentation:
- mw:Help:Magic words: All standard magic words, including the "standard" parser functions.
- mw:Help:Extension:ParserFunctions: Additional parser functions, including conditional expressions.
but the parser functions in mw:Help:Extension:ParserFunctions don't seem to be working, e.g.:
Is my syntax wrong, or is the aforementioned extension simply disabled in WP.en? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 13:13, 8 May 2021 (UTC)
- @Guarapiranga: Most of the ParserFunctions extension is enabled here, but the string functions are not. To check which magic words are available here, go to Special:Version and scroll down to the list of "Parser function hooks" at the bottom. -- John of Reading (talk) 13:42, 8 May 2021 (UTC)
- Thanks, John of Reading.
but the string functions are not.
- Why not? Are they bugged? It'd be great to use them instead of resorting to Lua for simple string operations like #len and #sub. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 13:47, 8 May 2021 (UTC)
- @Guarapiranga: For the history, see MediaWiki#Text manipulation. If you are only looking to use these functions a few times, you could use the templates listed at {{String-handling templates}}. For example, {{str len}} replaces #len. -- John of Reading (talk) 14:08, 8 May 2021 (UTC)
If you are only looking to use these functions a few times
- Yeah, I'm not, hence my interest. Lua breaks after just a few calls in a table (example). Perhaps there's another way to streamline it, but I was hoping this would be it. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 14:14, 8 May 2021 (UTC)
- @Guarapiranga: For the history, see MediaWiki#Text manipulation. If you are only looking to use these functions a few times, you could use the templates listed at {{String-handling templates}}. For example, {{str len}} replaces #len. -- John of Reading (talk) 14:08, 8 May 2021 (UTC)
REVISIONTIMESTAMP conversion to plain text
The REVISIONTIMESTAMP magic word gives a string of numbers. Is there any easy way to convert it to a human-readable format? This would be nice for {{Closing}}. (please use {{ping|Sdkb}}
on reply) {{u|Sdkb}} talk 03:13, 17 May 2020 (UTC)
- The #time function will probably help you.
{{#time:H:i, j F Y|{{REVISIONTIMESTAMP}}}}
. See mw:Help:Extension:ParserFunctions##time for time options. – Jonesey95 (talk) 05:10, 17 May 2020 (UTC)- @Sdkb: What Jonesey95 just said. - dcljr (talk) 21:48, 17 May 2020 (UTC)
- @Dcljr and Jonesey95: thanks both! {{u|Sdkb}} talk 21:56, 17 May 2020 (UTC)
- You might like to put the time zone in too, to make it more resilient for scripts and bots -
{{#time:H:i, j F Y (e)|{{REVISIONTIMESTAMP}}}}
→ 15:39, 3 July 2024 (UTC). --Redrose64 🌹 (talk) 22:12, 17 May 2020 (UTC) - ... or go with an international format such as —
{{ #time:Y-m-d H:i:s|{{REVISIONTIMESTAMP}} }}
⇒ 2024-07-03 15:39:30 — GhostInTheMachine talk to me 12:10, 16 May 2021 (UTC) - The following is longer, but should format the date according to the different user preferences —
{{#dateformat:{{ #time:Y-m-d H:i:s|{{REVISIONTIMESTAMP}} }}}}
⇒ 2024-07-03 15:39:30 — GhostInTheMachine talk to me 12:10, 16 May 2021 (UTC)
- You might like to put the time zone in too, to make it more resilient for scripts and bots -
- @Dcljr and Jonesey95: thanks both! {{u|Sdkb}} talk 21:56, 17 May 2020 (UTC)
- Or you can use {{REVISIONDAY}}, {{REVISIONMONTH}} and {{REVISIONYEAR}} instead, if it suits you better. I wonder why these are all deemed "expensive functions" (when addressed at a different page), though. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 00:46, 16 May 2021 (UTC)
- Expensive generally implies an extra database request. The revision date is available for the current page, but it needs an extra database request to get the same information for a different page. In this case, the first REVISION function for a different page will be expensive, but the other 2 should then get the information from the cached data — GhostInTheMachine talk to me 13:05, 16 May 2021 (UTC)
- @Sdkb: What Jonesey95 just said. - dcljr (talk) 21:48, 17 May 2020 (UTC)
NOTOC + infobox creates blank line
If an article starts with:
__NOTOC__
{{Info/Organization
|nome = Org name
then there will be a blank line at the beginning of the article. I could only get ri of it gluing the NOTOC particle into the infobox invocation:
__NOTOC__{{Info/Organization
|nome = Org name
I found that unexpected. fgnievinski (talk) 16:42, 9 August 2021 (UTC)
REVISIONID ?
Is there a way to get the REVISIONNUMBER (RevisionID) of a specific revision? Revisionday, -month, -year, -timestamp, -editor are all available, but I would like to have the ID of the revision. REVISIONUMBER does give an error, REVISIONID does not give an error, but '-' is not the expected result. Thanks in advance, RonnieV (talk) 00:45, 2 March 2022 (UTC)
Current Year
How to use in a redirect?. For example,
#redirect [[United Nations Climate Change conference#{{CURRENTYEAR}}]]
to go to the current year section in the UNCCC article?:
United Nations Climate Change conference#2022
--BoldLuis (talk) 10:48, 17 May 2022 (UTC)
- @BoldLuis redirects (and articles in general) shouldn't use dynamic values, because the cached copy of the page will "stick" on the old version. — xaosflux Talk 13:06, 17 May 2022 (UTC)
- Thank you. Really, it is a trouble to overcome by Wikipedia / MediaWiki . BoldLuis (talk) 13:50, 24 May 2022 (UTC)
Showing the user viewing the page
Help:Magic_words#cite_note-2 reads "There is no way to show the user viewing the page due to technical restrictions.". Actually, with a bit of JavaScript, it can be done. For non-JS and non-logged-in users, the HTML template can contain something generic, e.g.:
Welcome, <span class=username_placeholder>Wikipedian</span>!
if (mw.config.values.wgUserName) /* to only run code if the user is logged in */ {
for (count=0; count < document.getElementsByClassName("username_placeholder").length; count++) {
document.getElementsByClassName("username_placeholder")[count].innerHTML = mw.config.values.wgUserName;
}
}
EstherLoer 00:13, 26 May 2022 (UTC)
- Well sure, but this is a page about magic words, which can't do this themselves, I added that to the note. — xaosflux Talk 01:45, 26 May 2022 (UTC)