[Mediawiki-l] Specialnamespace

Christensen, Courtney ChristensenC at BATTELLE.ORG
Thu Sep 20 12:35:02 UTC 2007


Mic said:
--------------
I did it this way

$data=$this->naw_functs->_nawPatterns();
$title=Title::newFromID($data[2]['page_id']);
$article=new Article($title);
$mArticle =& $article;
$mArticle->fetchContent();

I hope it's the right way
regards
mic
---------------------------

Hi Mic,

It was suggested that you use revisions instead of article to retrieve
content.  I'd give credit where it is due, but I only saved the part of
that email I wanted to use.

"Because Article::getContent() is horrible and should never be used by
anybody outside of internal code that does article views. :)

For clean behavior, use the Revision class:

$rev = Revision::newFromTitle( $rev );
if( $rev ) {
    $content = $rev->getText();
} else {
    // Maybe do a nice error message here?
    $content = '';
}
"



More information about the MediaWiki-l mailing list