[Mediawiki-l] Extension help: why is text appearing twice?

Daniel Barrett danb at VistaPrint.com
Wed Aug 29 16:32:14 UTC 2007

>> $wgHooks['OutputPageBeforeHTML'][] = 'Problem';
>> function Problem(&$parser, &$text) {
>>   $text = "$text abc";
>> }

Rob Church wrote:
>You'll need to accept the correct parameters for the hook and use an
>appropriate method to append to the page. See docs/hooks.txt.

I took your advice, but for some reason, I cannot get
'OutputPageBeforeHTML' to run at all. For example, here is a hook
function that should simply blow up, but it doesn't do anything. I don't
think it's even being run.  I also hook ParserBeforeTidy (successfully)
in the same file just to prove it's actually being loaded in
LocalSettings.php (it is).

$wgHooks['OutputPageBeforeHTML'][] = 'vpHookOutput';
function vpHookOutput($parserOutput, $text) {
  $x = new ASKJDFKASDJFKDJFKJ(); // should crash, doesn't exist
  $i = 23 / 0;  // please, please crash...
$wgHooks['ParserBeforeTidy'][] = 'vpHookTidy';
function vpHookTidy(&$parser, &$text) {
  $text = "$text abcdefg";

MediaWiki pages still load fine, with "abcdefg" at the bottom (twice),
but no crash. Any idea why 'OutputPageBeforeHTML' seems to have no


More information about the MediaWiki-l mailing list