[Mediawiki-l] Creating an article object

Michael Heyder Info at hafenvolleyballer.de
Fri Aug 24 17:52:55 UTC 2007


Rob Church schrieb:
> On 24/08/07, Michael Heyder <Info at hafenvolleyballer.de> wrote:
>> Hi,
>>
>> 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::makeTitle()
> * Title::makeTitleSafe()
> * Title::newFromText()
> 
> For example:
> 
> $title = Title::newFromText( "Creating Article object" );
> $article = new Article( $title );
> 
> 
> Rob Church
thanks,


after a small look at the title class i solved the problem.
Have a nice weekend

greetz
mic




More information about the MediaWiki-l mailing list