Jump to content

Manual talk:Variable

Add topic
From mediawiki.org
Latest comment: 12 years ago by Treitter in topic Problems with variables example code

Problems with variables example code

[edit]

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:

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