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

Jim Hu jimhu at tamu.edu
Wed Aug 29 17:41:59 UTC 2007


I suspect that dividing by zero doesn't crash, I bet it sends an  
error to the log.
When I want to check that execution got somewhere by crashing I use  
exit;
On Aug 29, 2007, at 11:32 AM, Daniel Barrett wrote:

>>> $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).
>
> <?php
> $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
> effect?
>
> DanB
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l

=====================================
Jim Hu
Associate Professor
Dept. of Biochemistry and Biophysics
2128 TAMU
Texas A&M Univ.
College Station, TX 77843-2128
979-862-4054




More information about the MediaWiki-l mailing list