What exactly is the difference between Article and WikiPage? It seems like one is just an encapsulation of the other.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | [email protected] On Fri, Aug 17, 2012 at 12:03 PM, Daniel Friesen <[email protected]>wrote: > On Fri, 17 Aug 2012 08:02:23 -0700, Mauricio Etchevest < > [email protected]> wrote: > > Hi, >> >> I´m developing a extension and I need to add an article to a category. >> >> I only get the title of the article, so I try this: >> >> $articleToAdd = new Article($title); >> >> $context = $articleToAdd->getContext(); >> $resArticle = MediaWiki::articleFromTitle($**title, $context); >> >> $linksupdate = new LinksUpdate($resArticle->**getTitle(), >> $resArticle->getParserOutput()**, $f); >> $ps = $linksupdate->getParserOutput(**); >> $categoriesLinks = $ps->getCategoryLinks(); >> >> >> ..so I get all the categories for the article, but I need to add and >> remove >> a category. How can I do that ? >> >> >> >> Thanks! >> Maurice.- >> > > Firstly, don't use Article, use WikiPage. > > We don't have an API to add/remove categories. So adding a category is > nothing but appending category WikiText to the end of the page. And > removing one is an ugly mess of using regexps to find some WikiText that > looks like the category link you're looking for and erasing it. > > On the other hand we DO have an api for things hooked into the parser to > add categories that aren't marked up in the page (maintenance categories > from tag extensions, etc...) > > -- > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] > > > ______________________________**_________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/**mailman/listinfo/wikitech-l<https://lists.wikimedia.org/mailman/listinfo/wikitech-l> > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
