Extension talk:MagicNumberedHeadings/Archive

Mediawiki 1.12 " PHP Notice: Use of undefined constant MAG_NUMBEREDHEADINGS"
although it works just fine, this PHP notice was showing up in the httpd error_log:  PHP Notice: Use of undefined constant MAG_NUMBEREDHEADINGS assumed 'MAG_NUMBEREDHEADINGS' in /var/www/html/wiki/extensions/MagicNumberedHeadings/MagicNumberedHeadings.php on line 77  resolved by editing MagicNumberedHeadings.php line 77 from:

to

--62.56.165.173 11:21, 1 July 2008 (UTC)


 * I had this same issue and used the same fix with versions:

!Product!! Version
 * MediaWiki|| 	1.13.3
 * PHP|| 	5.2.8 (apache2handler)
 * MySQL|| 	5.1.30
 * } -- Highland 13:14, 24 December 2008 (UTC)
 * MySQL|| 	5.1.30
 * } -- Highland 13:14, 24 December 2008 (UTC)
 * } -- Highland 13:14, 24 December 2008 (UTC)
 * } -- Highland 13:14, 24 December 2008 (UTC)

Seems not to work with v1.13
I just added the extension to my wikis. They all run on v1.13. I recieve the error message: Use of undefined constant MAG_NUMBEREDHEADINGS - assumed 'MAG_NUMBEREDHEADINGS' in C:\Programme\Wamp\www\w\extensions\MagicNumberedHeadings\MagicNumberedHeadings.php Compilation failed: invalid UTF-8 string at offset 3 in C:\Programme\Wamp\www\w\includes\MagicWord.php

Does anyone have an idea?

thanks in advance best regards --TurboKanne 11:02, 23 September 2008 (UTC)


 * Probably those Ü and Ö letters at lines 71 and 74 (cases de and ksh). Delete those lines (just leave the default line), take them in those /** */ brackets for PHP comments (of course NOT the default lines), or replace the respecting magic words for those languages with ones without umlauts. (I chose the second option, and now it works.) -- JörgM 84.156.139.3 20:54, 29 March 2009 (UTC)
 * And for the first line of the error message try what the users in the thread above have done. -- JörgM 84.156.139.3 20:56, 29 March 2009 (UTC)

Problems with templates
I tried to use __NUMBEREDHEADINGS__ inside a template that is used in several articles. Instead of the headings numbered, i get the text "__NUMBEREDHEADINGS__". It seems, that the magic word is not "replaced".

If i use __NUMBEREDHEADINGS__ on a standard page it works perfect.

--Planetenxin 14:00, 16 October 2008 (UTC) The problem is that when the  hook gets called, only the text of the page is available, the template hasn't been expanded yet. Only one hook is available (at least in MW 1.16) that allows a change to the header option before it's too late after all templates have been processed, and that's InternalParseBeforeLinks. To get MagicNumberedHeadings to work, edit MagicNumberedHeadings.php and make these changes (don't get on me about the remedial patch syntax, I'm doing it for the kids): ... around line 52 REMOVE: $wgHooks['ParserBeforeInternalParse'][] = 'MagicNumberedHeadingsParserBeforeInternalParse'; ADD: $wgHooks['InternalParseBeforeLinks'][] = 'MagicNumberedHeadingsInternalParseBeforeLinks';

... around line 90 REMOVE: function MagicNumberedHeadingsParserBeforeInternalParse($parser, $text, $stripState) ADD: function MagicNumberedHeadingsInternalParseBeforeLinks($parser, $text, $stripState) This applies to a few other extensions I saw, so if you're searching for "why doesn't it work in a template" problems, take a look here too. --Skew 20:30, 21 April 2011 (UTC)


 * That's terrific! Thanks for the hint. --Nakohdo 18:26, 25 May 2011 (UTC)

NoWiki trick for Special:Version
Putting the whole magic word in MagicNumberedHeadings.php between tags like so doesn't seem to work on Special:Version:

__NUMBEREDHEADINGS__

However, putting the tags around only part of the magic word does the trick:

__ NUMBEREDHEADINGS__

--Nakohdo 18:12, 25 May 2011 (UTC)

Doesn't seem to work in 1.19
I tried to use this for the first time with 1.19 but it doesn't seem to recognize and replace the magic word. Is anyone using this with a more modern version of Mediawiki?

I made the suggested changes to the script but still no luck.

Thanks!

Konjurer (talk)


 * Does work as promised on MediaWiki 1.20.2, PHP 5.3.21 (apache2handler) --Nakohdo (talk) 12:28, 8 April 2013 (UTC)