Extension talk:ParserFunctions/LQT Archive 1

See: meta:Help_talk:ParserFunctions for much more conversations about this extension.

Strings
Suggestion: It would be useful if also strings could be compared.--Eloy 23:16, 27 March 2008 (UTC)

Am I missing some major fact here?
I feel dumb! I installed the extension (I'm on MW 1.12.0), it shows up on Special:Version but when I add or some other easy example on some article it only displays in plain text. Maybe I need to install something else? --Subfader 12:37, 9 April 2008 (UTC)
 * No idea if this is it / what I should do, but it was introduced in 1.12 Manual:$wgParserConf --Subfader 13:19, 9 April 2008 (UTC)
 * Ok got it working by moving require... above all other require... --Subfader 16:49, 10 April 2008 (UTC)

Similar problem as the one of Subfader
I have a similar problem, but with a small exentension I wrote. Before upgrading to 1.12 it worked OK, now just displays in the article. Moving the includes/reuqire statement didn't work. The exetension was developed based on an example for the parser extensions, but I can't find the link anymore. ParserFunctions as well as the file are includesd/required in the LocalSettings.php

setFunctionHook( 'arreminderdisplay', 'wfArReminderFunction_Render' ); } function wfArReminderFunction_Magic( &$magicWords, $langCode ) {    # Add the magic word # The first array element is case sensitive, in this case it is not case sensitive # All remaining elements are synonyms for our parser function $magicWords['arreminderdisplay'] = array( 0, 'arreminderdisplay' ); # unless we return true, other parser functions extensions won't get loaded. return true; } function wfArReminderFunction_Render( &$parser ) {    # The parser function itself # The input parameters are wikitext with templates expanded # The output should be wikitext too //Erinnerung erst nach dem 25. jeden Monats anzeigen //if((int)date("j") < 25) //{ 	// return ""; //}    return "  "; } ?> --151.71.24.254 09:15, 22 April 2008 (UTC)
 * 1) Define a setup function
 * 1) Add a hook to initialise the magic word

Problems with #switch
I just installed v.1.1.1 on MW 1.12.0, but any time I try to create a page with a "#switch" in it, my server won't serve the page correctly. Instead of showing a page, it gives me the option to download "index.php" which is a 0 byte file. Other parserfunctions ("ifexist" for example) work fine. Does this happen to anyone else? -SColombo 12:06, 5 June 2008 (UTC)

Older versions
Is there any way to get old versions of this extension? I'm specifically interested in a version which would work with MediaWiki 1.5.6 under PHP4 (not PHP5, which is required for modern versions).

Parse error
On 1.12, I've run into what may be an interesting problem: ''Parse error: syntax error, unexpected '{' in extensions/ParserFunctions/ParserFunctions.php on line 74. (http://rafb.net/p/NEDkaT63.html)'' This occurs on multiple wikis/different websites I operate, all under the same host. I'm told by several proficient mwikians/devs that the code is correct (they can't figure it out either); yet no matter what I do, fresh installs, etc., the error persists. I'm trying to fathom if it's a server or filepath issue and what the nature of it is, if that's the case, so I can explain it to them. (They're wiki-illiterate.) --Sasoriza 19:12, 21 July 2008 (UTC)
 * Disregard. Apparently it was a PHP version problem (thanks domas). If anyone should ever encounter the above issue, make sure you're running PHP5x. Still, the timing was very strange. Happened right after I tried installing this extension (and no, I won't try again; call me superstitious). -- Sasoriza 04:18, 22 July 2008 (UTC)

Error with a Function
I have discovered an error with #ifexist function from this extension. If there is an internal link in the either of the outputs for the function, then that link will show up in all of the relevant Special Pages regardless of whether the target pages exists or not.--Mjr162006 22:59, 21 July 2008 (UTC)
 * It's not an error, it's just how the Parser works. Everything inside both the then and else statements get evaluated, regardless of which one is true. The true one is then displayed. Depending on the contents of the output statements, some things may trigger unexpectedly. -- Skiz zerz  02:08, 22 July 2008 (UTC)


 * Hmm... Even if it is not an error, it is still a problem correct? Is there any way at all to program this out of the extension? The other parser functions don't seem to have this problem. The reason this is an issue, is because it messed up our Special Pages: Disambiguations, Whatlinkshere, and Wanted Pages. It kept on showing links that didn't exist. That was all thanks to the ifexist function. Those of us that were trying to fix redirecting links and links to disambiguation pages were essentialed stopped in our tracks by this problem. For now, we went into the templates that used the function and formated the links as external links, but made them look like normal links with plainlinks option with the span tags. But it would be nice if this was corrected in the extension itself. I'm my wiki's resident expert on such things, and it took me a few days to realize that the ifexist function was the cause of it all.--Mjr162006 05:27, 22 July 2008 (UTC)
 * It still is a problem, since it really shouldn't be doing that... I'm guessing it's because it utilizes the Link Cache to check for existence of the pages. Just to be safe, though, what MediaWiki and ParserFunctions versions are you running, and what ifexist function is causing this issue (if there are more than one, just paste one)?-- Skiz zerz  15:26, 22 July 2008 (UTC)

Here you go:

We have version 1.1.1 of ParserFunctions. I think the best way to tell you is to give you the entire story. Some our important templates for certain page operations, like merging, splitting, and moving; as well as a few other templates, link to the article's talk page. Many of those talk page's didn't exist, thus flooding our Wanted Pages. So, we used the ifexist function to form the link if the talk page existed, and to display plain text if it did not. We began to notice the Disambiguations special page was showing pages linking to game disambiguation pages when they in fact didn't. We then noticed that the special page indicated had a certain template in it. So I went in the template and reorganized it. The template no longer exhibited problems but I had no idea as to the cause. About a week later, another user noticed that the delete template causing talk pages to show up in the wanted pages even though the links didn't exist. This was a was very similar problem as the last template had. So I examined its code. I then noticed that both templates used the ifexist function. Realization dawned upon me. I went and check every other template that used this function. Every single one was having the exact same problem. We were formating the ifexist function like this:

But that was cause the problem. Our solution for the time being is to format the ifexist function like this:

That's my story. I hope it helps.Mjr162006 03:06, 23 July 2008 (UTC)


 * If you have any more questions for me that might help solve this problem, then you must know that I will be unable to respond. I'm leaving to go on a camping trip for about four days. I'll ask another one or two of our users to come here and fill in.--Mjr162006 03:21, 23 July 2008 (UTC)


 * Hello. I'll be taking over this discussion on behalf of Mjr162006 during his absence. If you have any further questions regarding various aspects of our Wiki's configuration or need me to test something there, let me know, as I'll be checking in at least daily. --ZWAndo (Talk) 05:13, 23 July 2008 (UTC)


 * I'm here too. In case either of them aren't here, I may be. While I don't have as much knowledge on this subject (Heck, I understand but don't use them) as either Ando or Mjr162006, think of me as the helper. I'll answer what I can, and relay to them what I can't. ZWSeablue 14:31, 23 July 2008 (UTC)

problems with #ifexist (don't work)
"#ifexist:" is not working in my wiki as you can see:
 * My Sandbox wiki for test
 * Wiki Sopa de pedres (public project wiki)

I have this configuration:
 * MW 1.12.0
 * ParserFunctions 1.1.1 r41321

I have also installed:
 * SMW 1.2
 * SF 1.2.6
 * reCaptcha

Other parser functions are working fine.

--Dvdgmz 08:07, 29 September 2008 (UTC)
 * Try using the 1.12.x version from Special:ExtensionDistributor/ParserFunctions instead. Mr.Z-man 21:14, 29 September 2008 (UTC)


 * Hi, I tried with 1.12.x and with the current version (1.14) but the problem persist: ifexist test --Dvdgmz 15:07, 30 September 2008 (UTC)

Problem with Time parser function
I posted a question on the ParserFunctions help talk page having to do with a problem with time functions when having a 2 digit date. If anyone has a clue of how to fix it, it would be greatly appreciated! (apologies for not having a screen name; I have one on wikipedia I use a lot, but I just came here to try and figure out why the error was occurring in edits I made at wikipedia) Thanks. 24.236.101.233 09:42, 30 December 2008 (UTC)

Why is #ifexist marked out as an expensive parser function?
Perhaps this is one for bugzilla but before I post a bug there, I have a question. If I write

is the result one database request to see if the article exists or two? Given that every link on Wikipedia is in effect

so you might understand my curiosity over why #ifexist uses more resources than any link on any page. Blue-Haired Lawyer 12:39, 24 February 2009 (UTC)

Using expr - Function in inline queries
I am trying to do something like this:

while MyTemplate does nothing more than

+

So I try to ask for all articles that fit the conditions above. What I get as a result is a number, no text, thats defined by convention. And each result is put in the template, adding a "+". The outer-Expression #expr should receive these results and add them. But all I get is an Error, saying that the char "[" is undefinded. I guess the inner-ask is responsible for this message because of the conditions  etc.

Is there a way of solving this problem or maybe there are alternatives fitting my purposes? --Mr.Reed 08:48, 04 March 2009