Help talk:Magic words

BASEPAGENAME and SUBPAGENAME do not output properly
I am running an installation of Mediawiki 1.11.0, and I cannot get  to output the appropriate page name. If the page is called "title/foo", it is supposed to output "title", but instead I get "title/foo". Same output with. Would appreciate some help... --Wikitonic 18:37, 14 November 2007 (UTC)
 * Set $wgNamespacesWithSubpages to true for the namespaces where you want to use these templates. (It's better to ask these questions on Project:Support desk.) i Alex  08:17, 15 November 2007 (UTC)
 * Thanks! I'll try to post in a better place next time. --Wikitonic 16:22, 15 November 2007 (UTC)

User's User Name?
will link to your profile: Subfader But how about a code that returns your user name as plain text so i can use it for codes and links? --Subfader 11:05, 28 March 2008 (UTC)


 * I know that Uncyclopedia uses  in their article on You, but I think that one might be a custom magic word for them only. -- Lightsup55  ( T | C ) 07:30, 26 January 2009 (UTC)

same question: Test --Martin 16:56, 5 June 2009 (UTC)


 * This is answered below. Happy ‑ melon 17:54, 5 June 2009 (UTC)


 * Actually, per the original question "But how about a code that returns your user name as plain text so i can use it for codes and links", one can now use   . Splarka 07:17, 6 June 2009 (UTC)

felix -7/30/09
 * If you're talking about doing some PHP (for coding) you can call the global $wgUser, and do something like $user = $wgUser->getName;

Section name
Is there any variable (or extension that enables it) which returns the current section name? Would be useful for manually inserting edit links. 193.62.111.10 09:47, 3 April 2008 (UTC)
 * I second this. Access to the current section name/number would be very helpful on occasion. ⇔ ChristTrekker 20:06, 4 September 2008 (UTC)


 * MediaWiki's bug-tracking database already has an old request for a section number variable. See 1605. --Zigger 16:42, 10 November 2008 (UTC)

Sync?
I have added a few that seemed to have been missed, like filepath and pagesize, but when about to add #special, I saw that #language and #tag aren't listed here, but are on m:Help:Magic_words. Should I add them? They are ptechnically parser functions, but so are many of the one listed here already. The definition of parser function vs variable is a bit hazy, so separating them isn't terribly easy. Here are all the (as of r33875) defined core parser functions:

Should all of these either all be included, or all moved to Help:Parser functions? Splarka 23:10, 24 April 2008 (UTC)


 * I think including them on this page would be better, so it's easier to reference or look something up. Maybe add a "Parser function" section? — Pathoschild 08:37:53, 15 May 2008 (UTC)

shows a wrong number
Hi,

I use  in the main page of my site. at the moment in the name space I have about 20 articles but just says ten.

I have:
 * 1)  MediaWiki: 1.11.0
 * 2) PHP: 5.2.4 (cgi)

how could that be fixed?

thanks,

--DonGiulio 20:48, 1 May 2008 (UTC)

START
The magic word __START__ does not appear in the list $mDoubleUnderscoreIDs defined in MagicWord.php. John Vandenberg 02:58, 30 July 2008 (UTC)


 * Start and End are obsolete. --G.Hagedorn 08:27, 10 March 2009 (UTC)

something to obtain image dimensions?
There's a variable or something to get the "dimensions" of a file in the "Image" description pages?

(I want to put this info in a property using SemanticMediaWiki; I see the info is there but I don't know how to obtain it)

Thanks in advance.

Dvdgmz.--Dvdgmz 11:09, 3 September 2008 (UTC)

__NEWSECTIONLINK__ or alternative in 1.6.10?
is there any alternative to __NEWSECTIONLINK__ or in 1.6.10?

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: =

Magic word requests

 * User's User Name
 * Section name
 * image dimensions
 * page_id
 * Random GUID (Globally Unique ID) string

I would like to have page_id TechControl 21:00, 28 October 2008 (UTC)

Create Date ?
Hi, is there a way to display the date a page was created? I only found the REVISIONDAY - REVISIONTIMESTAMP, etc ... But i need the CREATEDATE. Can anyone help with a workaround? thanks in advance best regards --TurboKanne 08:56, 21 November 2008 (UTC)

How can I figure out the name space of a contribution
Hello, I'd like to know how to figure out that e.g. "Template:Unreferenced" is actually located in the name space template, the same for all other name spaces (files, categories, helps, etc.). I couldn't find any magic word like that. Would it be possible to create one (something like     resulting in "Template")? Does anybody know any other way to find it out?, regards, --Poco a poco 18:08, 22 February 2009 (UTC)
 * In the latest version of MediaWiki, you can use the   variable also as a parser function:    &rarr; . Happy ‑ melon 22:34, 22 February 2009 (UTC)

PAGESIZE:
Hi! Is there any way that PAGESIZE: displayed the size in a given number of digits? For example, something like   resulted 02,560. If you could answer in my wikipedia spanish talk page, altought i'll try to check this one. Thanks, Gons 23:14, 5 March 2009 (UTC).


 * Replied Splarka 08:30, 6 March 2009 (UTC)

" NOINDEX"
"NOINDEX" does not work with Google.68.4.177.125 21:06, 7 March 2009 (UTC)

Revision Date issues
We have both and. Any reason there is no, which would allow to create standard international ISO dates (2009-01-01)? Also, would be useful in a template we try to construct. --G.Hagedorn 08:30, 10 March 2009 (UTC)
 * was added in Special:Code/MediaWiki/48149 (3 days ago) and has not made it past code review yet. Splarka 07:03, 11 March 2009 (UTC)
 * Cool - that is a nice coincidence! --G.Hagedorn 21:31, 13 March 2009 (UTC)

Q/ doesn't work on my wiki. You'v got any idea ?
 * A/ Needs MW 1.14++

Finding associated talk page
Is there a way, given a page name as parameter, to obtain the page name of the associated talk page? For example:

Happiness      -->  Talk:Happiness File:Happiness -->  File talk:Happiness

While I can get the talk page namespace with  , I don't see how to get the page within that namespace. For an example for which this is desirable, consider en:Template:nothanks-sd, which gets pre-filled from en:Template:db-filecopyvio as, for example,  File:Foo.JPG, so as to blithely produce defective links such as. --Lambiam 12:44, 23 March 2009 (UTC)

To answer my own question: en:Template:talk does the job. --Lambiam 13:18, 23 March 2009 (UTC)

FULLPAGENAME normal operation
If you use fullpagename or any of those magic words on an editnotice (for example, as a "view" or "edit" link that is meant to point to the editnotice), it will point to the desired page instead. I've encountered this on the English wikipedia (see this as an example). Everyone ok with adding a bit to that section to clarify this? Master of Puppets 15:49, 15 April 2009 (UTC)


 * It works the same way in templates. Expected. Nothing to do specifically with edit notices. Magic words apply to the page being viewed. This is already clarified at the top of the page:
 * Page-dependent magic words will affect or return data about the current page, even if the word is added through a transcluded template or included system message.
 * Splarka 19:48, 15 April 2009 (UTC)

and
it would be a useful feature for templates if we could use and  such as. e.g. is size of MediaWiki page.
 * It is not possible yet to got those for templates is it ? almaghi 12:57, 20 April 2009 (UTC)
 * Added in 49575, but that might get reverted. Seems a wee bit dodgy. Splarka 13:17, 20 April 2009 (UTC)
 * Ok thks for helping.--almaghi 12:53, 12 June 2009 (UTC)
 * This was reverted in 51424 Happy ‑ melon 13:39, 12 June 2009 (UTC)

DEFAULTSORT
Anyone else think the example given for DEFAULTSORT is just plain wrong? --Pascal666 19:57, 25 May 2009 (UTC)
 * Yup! Fixed Happy ‑ melon 20:12, 25 May 2009 (UTC)

Detail of sorting
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)
 * Even less useful than that, it appends the page_id of the page to the sortkey. Happy ‑ melon 19:07, 21 July 2009 (UTC)

GROUPCONVERT
Can anyone update this page? is introduced in r48984. —Bencmq 14:50, 1 June 2009 (UTC)
 * What does this function actually do? Happy ‑ melon 14:55, 1 June 2009 (UTC)

In Uncyclopedia has this magic word here and there still is not. This is very important in the creation of tutorials using the user name when you visit the page and also to welcome to the registered user that set the genre on user preferences with the magic word. If not create it you can teach me to create one? Thank you! HyperBroad 17:55, 2 June 2009 (UTC)
 * The Uncyclopedia implementation of   is a fake; it is done with JavaScript after the page is rendered by the MediaWiki software.  The devs have stated several times that they will not implement this magic word in the core software; as well as breaking page caching, it is also a significant privacy vulnerability: we do not want URLs like http://evil.website.org/log/ip/address?username= to become functional on MediaWiki installations. Happy ‑ melon 22:48, 2 June 2009 (UTC)
 * Thanks! HyperBroad 23:05, 2 June 2009 (UTC)

apostrophe in PAGENAME
What's expected value of PAGENAME for title with apostrophe? On pl.wiktionary for page titled "a peso d'oro" PAGENAME was evaluated (tested with subst:PAGENAME) as "a peso d&amp;#39;oro". I'm unsure whether it's bug or expected feature. ABX 17:11, 18 June 2009 (UTC)
 * This is sorta expected behavior (and would be a bit breaking to change later). See this for example. Splarka 07:19, 19 June 2009 (UTC)

Weather magic words
Would it be possible to create magic words based on the weather in a specific city? Many websites (and even the Wii) link to online ressources in order to display the local weather. I believe that this could be used to display the current weather for a given city on its Wikipedia page. The most basic one could simply make it return values such as "sunny" or "cloudy" and could be used to display a graphical representation. Others could display the current temperature and other such details. The chosen city could be denoted by a variable.--216.254.165.195 00:13, 20 June 2009 (UTC)
 * This could be written as an extension, but will never be incorporated into MediaWiki core. It is too far removed from MW's basic functionality. Happy ‑ melon 07:44, 20 June 2009 (UTC)


 * It's probably not something you'll ever see on Wikipedia (at least not for a while), but there are some extensions that either provide this functionality directly or could be adapted for it. —Emufarmers(T 09:12, 20 June 2009 (UTC)

Number Headings
Currently the user can specify tog_numberheadings as a global setting to display all headings with "#[.#] HeadingName", but page designers can't specify this as the default action on a per-page situation. This feature is helpful when writing specification or API documenation that need to be printed from time to time. Simple changes: MagicWord.php: 'numberheadings' added to mDoubleUnderscoreIDs static public $mDoubleUnderscoreIDs = array(               'notoc',                'nogallery',                'forcetoc',                'toc',                'noeditsection',                'numberheadings',                'newsectionlink',                'hiddencat',                'index',                'noindex',                'staticredirect',        );

Parser.php, function formatHeadings, after 'noeditsction': # Check to see if page requests number headings if ( isset( $this->mDoubleUnderscores['numberheadings'] ) ) { $doNumberHeadings = 1; } And in the Messages files: 'numberheadings'        => array( 0,    '__NUMBERHEADINGS__'     ),

Then the page designer can place __NUMBERHEADINGS__ anywhere and have the sections numbered. --Jtmcdole 14:17, 20 June 2009 (UTC)
 * This sounds like a good idea! You'd need to file a bug over at bugzilla to bring it to the attention of the MediaWiki developers. Happy ‑ melon 21:20, 26 June 2009 (UTC)

Blue Background?
With witch code can I make this blue background (this with the (C) ) ? --Webing 18:04, 14 July 2009 (UTC)
 * This is defined in our site CSS. Take a look: it's fairly well commented. Happy ‑ melon 22:53, 14 July 2009 (UTC)

Incomplete
Where's the others? msg, msgnw, raw? 71.155.241.31 23:32, 12 August 2009 (UTC)
 * Some of those are covered on Help:Templates as some users consider them more as transclusion modifiers, I guess? Anyway, feel free to add them. Splarka 08:02, 13 August 2009 (UTC)
 * I guess it makes sense there. I just thought this was supposed to be a complete list. 71.155.241.31 06:52, 14 August 2009 (UTC)

Formatting: padleft and padright
According to the very helpful links in padleft</tt>, the handling of the third parameter for both functions has changed significantly:
 * The char</tt> parameter is actually a string. If necessary, the last copy of the string will be truncated from the end, to fill the allocated space (second parameter) exactly.
 * The string may include multi-byte characters, which will be properly treated as single characters.

Before I update the main page, I would greatly appreciate a nod from somebody who actually understands php, and MW releases. --LCE1506 14:30, 29 August 2009 (UTC)

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 ) with the folowing code and I got errors. But the following code (with an empty anonymous parameter) seems good (see ).

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


 * Why do you consider it a bug?


 * produces

&lt; tagname parameter =" value "&gt; content &lt;/ tagname &gt;
 * In your first example, you were sticking lat=47.2553</tt> in as the content. Maybe it should be interesting to use it properly ^_^. Splarka 07:39, 1 September 2009 (UTC)
 * Because the syntax  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  FrViPofm 08:38, 1 September 2009 (UTC)
 * 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)

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)

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)