[Mediawiki-l] Embed Special:Random
Helmut Schneider
jumper99 at gmx.de
Tue Mar 18 16:24:04 UTC 2008
<zehetner at molgen.mpg.de> wrote:
> It seems Special:Random just creates a full URL to a random page in the
> wiki and than redirects (and loads) that URL.
>
> $wgOut->redirect( $title->getFullUrl() );
>
> if one replaces in SpecialRandompage.php that line with
>
> $article = new Article($title);
> $wgOut->addWikiText($article->getContent());
>
> than it does exactly what you expect: it includes the content of a
> random page into another page. So maybe you should create a new special
> page 'Special:Randomcontent'?
That seems the right direction, indeed, nice. Unfortunately it seems to
impact some other functions/extensions, e.g. NewestPages
(http://www.mediawiki.org/wiki/Extension:Newest_Pages).
{{Special:NewestPages}} now produces something like:
UNIQ18de99db71f8b6d3-item7025fdcb3d145835
Here is what I did:
Copied SpecialRandompage.php to SpecialRandompageRedirect.php
In SpecialRandompageRedirect.php I replaced
function wfSpecialRandompage
with
function wfSpecialRandompageRedirect
and also
$rnd = new RandomPage();
with
$rnd = new RandomPageRedirect();
and also
class RandomPage
with
class RandomPageRedirect
In Autoloader.php I added
'RandomPageRedirect' => 'includes/SpecialRandompageRedirect.php',
and in SpecialPage.php
'RandompageRedirect' => array( 'IncludableSpecialPage',
'RandompageRedirect' ),
--
No Swen today, my love has gone away
My mailbox stands for lorn, a symbol of the dawn
More information about the MediaWiki-l
mailing list