Extension talk:RandomSelection/Archive

Version 1.5rc4
Just replace the caching section with this:

# Prevent caching global $wgParser; $wgParser->disableCache;

--ProgMania 00:01, 4 September 2005 (UTC)

Option tag
This is a most useful extension, but I would suggest that the tag be replaced by a tag of a different name as this tag already exists in HTML and may lead to a conflict on closed wiki installations that have that tag enabled. Great script. 86.132.17.233 14:16, 8 November 2005 (UTC)

Random articles in category(ies)
An option to show a link to a random article in a specific category (or groups of categories) would be nice; randomized DPL parameters too. —Eep² 13:51, 20 August 2007 (UTC)

MW_PARSER_VERSION?
I notice that the extension looks at MW_PARSER_VERSION to determine which MediaWiki version is running. This value appears not to be defined at all any more by MediaWiki as of the "new" parser in MW 1.13 (and likely the later 1.12alpha) versions. Will this have any affect on operation? --Carlb 19:59, 23 February 2008 (UTC)


 * Well spotted! Fixed in latest version. --Algorithm 21:08, 23 February 2008 (UTC)

One issue I've noticed with the new parser (MW1.13 and later revisions of 1.12) is that template substitution is handled differently than in the old version. This can cause problems if a template containing random choose/option tags is called repeatedly from the same page. On the old MediaWiki, each invocation would yield a different random answer. On the new version, the templates are expanded first, then the same result may be placed in the page multiple times - a problem for templates like -style factoids that are used repeatedly to generate one random text item per invocation. Call these as (so that the parser is fooled to think there's a parameter there, which could leave the result subject to change) and they work - an ugly kludge but necessary for pages like http://psyklopedin.org/wiki/Huvudsida and http://desciclopedia.ws/wiki/Síndrome_de_Tourette - at least if all cache support (including APC/memcached) is in use.

Wikia presumably is unaffected so far as their antiquated MediaWiki version still has the old parser, but the current MediaWiki does appear to be acting differently. ¿Que pasa?


 * Unfortunately, if this is the case then there's not much I can do with my extension to change it. Your hack is probably the most effective workaround for newer versions. --Algorithm 06:56, 21 April 2008 (UTC)

Installation
Maybe it's obvious, just I don't actually get how this extension is implemented into my MediaWiki project. I could start guessing which php file to extent with the code, but I'm not (yet) at that level of programming. A hint would be most appreciated. --Carsten3m 10:44, 17 April 2008 (UTC)
 * Figured it. For everyone else not having a clue how to install this extension: Add the code at the end of your LocalSettings.php --Carsten3m 11:01, 17 April 2008 (UTC)

The usual method of installing MediaWiki extensions is to put the code into a separate file (whatever.php) then include that file require_once('whatever.php'); somewhere in LocalSettings. This is true of MediaWiki extensions in general - not just this one. --04:46, 21 April 2008 (UTC)

Undefined property notice
HI, I've just upgraded to MW 1.12, and I'm now getting the following on my main page (which is where I'm using the extension):

Notice: Undefined property: Parser::$mTemplates in /home/restofpath/extensions/RandomSelection.php on line 64

Notice: Undefined property: Parser::$mTemplatePath in /home/restofpath/extensions/RandomSelection.php on line 65

I've also updated my parser extensions to the latest, but still get those messages.

Any ideas?

Thanks 118.92.29.247 06:38, 22 April 2008 (UTC)