Manual talk:Variable

Problems with variables example code
I've hit a couple problems with the example code on this page.

Firstly, the file listed on this line seems to be incorrect:

$wgExtensionMessagesFiles['ExampleMagic'] = dirname(__FILE__). '/Parser_function.i18n.magic.php'; // should be '/Example.i18n.magic.php';

But even after fixing that, I run into this problem:

Magic word 'mycustomvar1' not found Backtrace:
 * 1) 0 /usr/share/mediawiki/includes/MagicWord.php(244): Language->getMagic(Object(MagicWord))
 * 2) 1 /usr/share/mediawiki/includes/MagicWord.php(197): MagicWord->load('mycustomvar1')
 * 3) 2 /usr/share/mediawiki/includes/MagicWord.php(522): MagicWord::get('mycustomvar1')
 * 4) 3 /usr/share/mediawiki/includes/MagicWord.php(647): MagicWordArray->getHash
 * 5) 4 /usr/share/mediawiki/includes/parser/Parser.php(2741): MagicWordArray->matchStartToEnd('imageserver')
 * 6) 5 /usr/share/mediawiki/includes/parser/Preprocessor_DOM.php(959): Parser->braceSubstitution(Array, Object(PPFrame_DOM))
 * 7) 6 /usr/share/mediawiki/includes/parser/Parser.php(2632): PPFrame_DOM->expand(Object(PPNode_DOM), 0)
 * 8) 7 /usr/share/mediawiki/includes/parser/Parser.php(875): Parser->replaceVariables('Images??F...')
 * 9) 8 /usr/share/mediawiki/includes/parser/Parser.php(327): Parser->internalParse('Images??F...')
 * 10) 9 [internal function]: Parser->parse('Images??F...', Object(Title), Object(ParserOptions), true, true, 9)
 * 11) 10 /usr/share/mediawiki/includes/StubObject.php(58): call_user_func_array(Array, Array)
 * 12) 11 /usr/share/mediawiki/includes/StubObject.php(76): StubObject->_call('parse', Array)
 * 13) 12 /usr/share/mediawiki/includes/Article.php(3557): StubObject->__call('parse', Array)
 * 14) 13 /usr/share/mediawiki/includes/Article.php(3557): StubObject->parse('Images??F...', Object(Title), Object(ParserOptions), true, true, 9)
 * 15) 14 /usr/share/mediawiki/includes/Article.php(979): Article->outputWikiText('Images??F...')
 * 16) 15 /usr/share/mediawiki/includes/Wiki.php(450): Article->view
 * 17) 16 /usr/share/mediawiki/includes/Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 18) 17 /usr/share/mediawiki/index.php(116): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
 * 19) 18 {main}

which is caused by this line:

$customVariableIds[] = 'mycustomvar1';

This is with mediawiki 1:1.15.5-3build1 on Ubuntu 11.10 —The preceding unsigned comment was added by Treitter (talk • contribs) 16:41, 2 April 2012 (UTC)