Extension talk:RandomInclude

Feature requests

 * The caching disabling should be page-specific, maybe part of the extension. --166.70.232.84 13:37, 21 December 2006 (UTC)
 * Thank you for your feedback. It seems that version 1.0.2 can work without disabling the cache. --Fernando Correia 16:17, 21 December 2006 (UTC)


 * Ignore text between "noinclude" tags. This would allow to insert in the random text templates some text that would be shown to users viewing the template, but that would not be inserted as random text. --Fernando Correia 19:40, 21 December 2006 (UTC)


 * Ignore empty tips. --Fernando Correia 19:55, 21 December 2006 (UTC)


 * I realize that this might be out of date (good news, btw, it works on version 1.11.x!), but I was wondering if it would be possible to use it in a template. As of now, if you include in a template, it spits out the entire list, not just the individual ones. Unless I'm doing something wrong. 66.168.102.87 21:15, 3 February 2008 (UTC)


 * I'm having the same issue with spitting out the entire list. 207.154.82.33 05:21, 27 March 2008 (UTC)
 * Same problem here. In your output which includes the entire list, did you see surrounding &lt;random&gt; tags?  That's what I saw, and I think it means that  is getting parsed and translating its contents to &lt;random&gt;, but that the &lt;random&gt; tag isn't subsequently getting parsed, too.  So as a work-around I chose to just use the &lt;random&gt; in the first place, and that seems to be working.  This is in MediaWiki version 1.14.0, by the way. 68.101.39.250 17:52, 3 May 2010 (UTC)

Eats white space (solved)
Line 1 Line 2 Line 3 Line 1 Line 2 Line 3
 * If using the "white space at begining of line" to show a box around the text, it seems that the white space is "eaten" by the RandomInclude just for the first line of each section. I mean, if I write this (note the blank at the begining):
 * It is showed like this:
 * As an alternative solution I have used the tag.
 * Otherwise the extension works wonderfully. You can see it in use here.
 * Pululante --52.159.64.103 10:43, 8 February 2007 (UTC)


 * Version 1.1.0 allows the use of spaces on the first line of an entry. But this doesn't seem to work on the first entry, because when the extension receives it, the first space has already been removed. To circumvent this create a blank entry before the first entry. Blank entries are now ignored. See example below. --Fernando Correia 17:19, 8 February 2007 (UTC)

first entry, line 1 first entry, line 2 first entry, line 3

second entry, line 1 second entry, line 2 second entry, line 3

Template Spits out Entire List (workaround exists)
This was previously listed as a requested feature, but I think it's a bug. When using the tag, we get the entire list wrapped with  instead of a single element. --Yoderj 23:07, 4 May 2008 (UTC)

An alternative to the syntax is to use. This worked with MW 1.12 for me. --98.223.150.194 01:15, 5 May 2008 (UTC)


 * This sounds like a bug in the new parser. I'll try to get time to look into it. Jeblad 00:27, 28 August 2008 (UTC)
 * The work-around, apparently, is to just use the &lt;random&gt; tag instead of ; they're really equivalent, and the one gets translated into the other as an intermediate step. 68.101.39.250 17:55, 3 May 2010 (UTC)
 * It also doesn't work within raw HTML sections:




 * This is pretty much totally broken for me. None of the suggested workarounds give anything other than a blank page.  If I just use my template, that displays fine, but I can't get anything to select a random quote.  Best I can do is the whole list between random html-tags.  A fix and/or updated install instructions would be cool.  Thanks!  Oliepedia (talk) 18:07, 6 May 2014 (UTC)

Contributors
Source code contributors:
 * Fernando Correia: Original contributor.

1.0.0
Release date: 2006-12-21
 * Initial release.

1.0.1
Release date: 2006-12-21
 * Hide section edit links.

1.0.2
Release date: 2006-12-21
 * Disable parser cache for pages that use this extension.
 * Solve a bug with a title on the first line.

1.1.0
Release date: 2007-02-08
 * Ignores blank entries.
 * Supports spaces on the first line of an entry. Note: this doesn't work on the very first entry.

1.2.0
Release date: 2008-04-14
 * Additional keywords
 * pattern to use as boundary between items
 * separator rendered between items
 * count number of items
 * limit on runaway loop
 * period as minute, hour, day, week or seconds (integer)
 * mode is none or ordered depending on count
 * cache strategy, set to 'disable' to do no caching

1.3.0
Release date: 2008-04-14
 * Additional keyword
 * format string to do dpl-style of formating

1.3.1
Release date: 2008-04-14
 * Bugfix, missing format keyword in parser function

1.3.2
Release date: 2008-04-22
 * Bugfix, int changed with intval
 * added seed keyword

1.3.3
Release date: 2008-04-22
 * Bugfix, noeditsection interfers with the parser

1.3.4
Release date: 2008-04-23
 * Bugfix, pattern was not consistently handled

1.3.5
Release date: 2008-04-27
 * added hash keyword (avoid use of seed as it might interfer with other functions)

Formatstring as dpl
There should be an option to use a formatstring like the one used for DPL. 87.248.11.164 08:44, 14 April 2008 (UTC)

Better cache strategy
There should be a better cache strategy to avoid completly disabling the cache. Jeblad 10:11, 14 April 2008 (UTC)

Random seed
Use of random seed interfers with other use of the rand function. Also not every implementation respects setting the seed value. Jeblad 09:58, 26 April 2008 (UTC)

Not Working With MW 1.13
I just installed MW 1.13, and tried to use RandomInclude as I had before, But the include only adds the entire text of the RandomInclude.php file into my page instead of working as an extension, if that makes any sense at all. Anyone else experiencing this? Any Fix?


 * See Jeblad 00:28, 28 August 2008 (UTC)

The "period" parameter
Hi everybody,

I'd like to put a random text every day, so I used the syntax :

But when I refresh, my text keeps changing during the day. Do you have an idea about how to fix this problem ?

Thank you for your help --Marineam 17:39, 19 March 2009 (UTC)


 * What kind of system is the host for the wiki? Is it a Unix system? If "time" does not return a unix epoch integer it may behave like you describe. Jeblad 16:41, 25 April 2009 (UTC)

Line Breaks
I can't seem to get the extension to respect line-break embedded in the random text. Is there a way to force this? Thanks for the extension! 128.183.226.220 16:08, 4 December 2009 (UTC)


 * Not sure what you ask about&hellip; As a separator you can use \n, but I guess you want to use a linebreak inside a random note&hellip;
 * Ah, I see, it uses internalParse and htmlspecialchars. It could be rewritten without some of the htmlspecialchars-calls and rely on the parser to do further cleanup. I'll see if I can fix it someday, but I don't have the time right now. Jeblad 21:11, 8 December 2009 (UTC)

Undefined Index Error
I have RandomInclude on the main page of my Wiki. I'm seeing the following error in my Apache logs whenever I access the main page: [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: count in /var/www/wiki/extensions/RandomInclude.php on line 158 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: limit in /var/www/wiki/extensions/RandomInclude.php on line 159 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: cache in /var/www/wiki/extensions/RandomInclude.php on line 160 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: seed in /var/www/wiki/extensions/RandomInclude.php on line 161 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: hash in /var/www/wiki/extensions/RandomInclude.php on line 166 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: period in /var/www/wiki/extensions/RandomInclude.php on line 171 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: mode in /var/www/wiki/extensions/RandomInclude.php on line 193 [Sat Feb 27 13:44:12 2010] [error] [client 172.28.64.130] PHP Notice: Undefined index: format in /var/www/wiki/extensions/RandomInclude.php on line 224

Any idea what might be causing this? --Gkullberg 13:43, 27 February 2010 (UTC)
 * I (MediaWiki 1.15.1 PHP 5.2.8 (cgi-fcgi) MySQL 4.1.22-max-log) receive the same it seems. Here is the copy I have in my /extensions/RandomInclude.php and a copy from the error output.

Notice: Undefined index: pattern in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 155 Notice: Undefined index: separator in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 157 Notice: Undefined index: count in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 158 Notice: Undefined index: limit in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 159 Notice: Undefined index: cache in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 160 Notice: Undefined index: seed in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 161 Notice: Undefined index: hash in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 166 Notice: Undefined index: period in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 171 Notice: Undefined index: mode in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 193 Notice: Undefined index: format in /home/content/d/a/v/davidyoga/html/mediawiki/extensions/RandomInclude.php on line 224
 * --SomaticJourney 13:48, 2 March 2010 (UTC)
 * Bump (I'd like to see this extension work) --SomaticJourney 18:52, 8 March 2010 (UTC)
 * It's a notice, not an error. But if you want to turn it off notices just for that function, try changing the code as follows:


 * GreenReaper 01:36, 26 May 2010 (UTC)

making extension/RandomInclude/RandomInclude.php instead of...
putting it by default in extensions/ Will that break the script? I would test it but I have a previous issue Extension_talk:RandomInclude which already breaks this extension. My need is to keep my extensions/ dir organized. Thank you for this eat extension --SomaticJourney 13:36, 3 March 2010 (UTC)


 * The script should work, but I guess I know whats the problem. If the setup of the PHP environment is sufficient paranoid it can croak. My basic setup is with the extension as . Jeblad 18:01, 8 March 2010 (UTC)

Not working with MW 1.15.1?
I followed your instruction and it worked fine with MW 1.9.1.

But with MW 1.15.1 I receive the complete list of my quotes.

With { {#tag:random | { {Tips}}}} instead of I receive

Unbekannter Extension-Tag „Tips“

Buggy
This is a great extension and I'd like it to work, but there are a few problems, all of which have been mentioned.


 * HTML outputting as raw HTML when calling quotes from a template from within a (div).
 * the PHP notices (and under certain contexts I get "Warnings" too).
 * the tag syntax issue.

Any chance of this extension being updated to address these issues?

--DoubleSuitedChris 23:49, 1 June 2010 (UTC)