On 07/07/07, Carlos Jorge Andrade carlos.andrade@gmail.com wrote:
I set $wgParser->setOutputType('html'). Is this necessary ?
Probably not, a bog standard call to Parser::parse() will *hopefully* return HTML.
In this way, is the cache used internally ou is this a fresh parsing every time it's run ? How do I make it use the parser cache ?
It's quite straightforward; here's a quick snippet...
global $wgArticle, $wgUser, $wgParser; $cache = ParserCache::singleton(); if( ( $output = $cache->get( $wgArticle, $wgUser ) ) === false ) { $output = $wgParser->parse( $wgArticle->getContent(), $wgArticle->getTitle(), ParserOptions::newFromUser( $wgUser ) ); $cache->save( $output, $wgArticle, $wgUser ); } $text = $output->getText();
Rob Church