[Mediawiki-l] Creating an article object
robchur at gmail.com
Fri Aug 24 17:45:35 UTC 2007
On 24/08/07, Michael Heyder <Info at hafenvolleyballer.de> wrote:
> my last question for today.
> the only thing I've got is the title of the article (new one)!
> $title='Creating an article object';
> $article=new Article($title); // seems to be not the right way
If you had read the code documentation, or the comments for the
Article class, you would realise that the Article constructor accepts
a Title object.
MediaWiki uses Title objects all over the place to represent titles;
the Title class performs normalisation and handles issues such as
namespaces, etc. cleanly.
You therefore need to instantiate a Title, which is usually done with
one of the following factory functions:
$title = Title::newFromText( "Creating Article object" );
$article = new Article( $title );
More information about the MediaWiki-l