That is true. Also if it's interwiki. *--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | [email protected]
On Tue, Jan 15, 2013 at 11:12 AM, bawolff <[email protected]> wrote: > While it may be true that there are better methods to call for this > purpose, an article's id should be 0 if and only if it does not exist > (or perhaps if its in a fake namespace like special). > > -bawolff > > On Tue, Jan 15, 2013 at 10:15 AM, Tyler Romeo <[email protected]> > wrote: > > I think the best thing to do would be to just avoid getting the article > ID > > in the first place. If you have a Title object, you can just pass that > > object directly to either Article::newFromTitle or to WikiPage::factory. > > > > *--* > > *Tyler Romeo* > > Stevens Institute of Technology, Class of 2015 > > Major in Computer Science > > www.whizkidztech.com | [email protected] > > > > > > On Tue, Jan 15, 2013 at 9:11 AM, Harsh Kothari < > [email protected]>wrote: > > > >> Hi Andreas > >> > >> Try this > >> > >> $someobj = WikiPage::newFromId( $ID ); > >> > >> if(is_object( $someobj ) ){ > >> $text = $someobj->getRawText(); or you can use $text = > >> $someobj->getText(); > >> > >> } > >> else{ > >> > >> return true; > >> } > >> > >> Thanks > >> Harsh > >> --- > >> Harsh Kothari > >> Research Fellow, > >> Physical Research Laboratory(PRL). > >> Ahmedabad. > >> > >> > >> On 15-Jan-2013, at 7:14 PM, Andreas Plank wrote: > >> > >> > Hi, > >> > > >> > I'm using MW 1.20.2 and I want to get the content of a page for > >> > further parsing in a PHP application. The PHP application is triggered > >> > via a special page (Special:MobileKeyV1) and parses nature guides for > >> > mobile devices. > >> > > >> > I tried to get the content via getArticleID() ... > >> > $titleObj=Title::newFromText("Existing page"); > >> > $articleID=$titleObj->getArticleID(); > >> > Article::newFromID($articleID)->fetchContent(); > >> > etc. > >> > ... but it returns $articleID=0 although the page exits. With MW 1.18 > >> > this approach worked fine, but after upgrade to MW 1.20.2 it does not > >> > any more. > >> > > >> > How do I get the page content correctly? > >> > Article::newFromID($titleObj->getArticleID())->fetchContent(); does > >> > not work because getArticleID() returns 0 or -1 although the page > >> > exits > >> > Or can sombody post a hint, what I'm doing wrong? Is there any context > >> > class needed? > >> > Or where there some big changes (MW 1.18 → 1.20) that are not > >> > described yet on http://www.mediawiki.org/wiki/Manual:Title.php ? > >> > > >> > I did also a > >> > sudo php ./maintenance/rebuildall.php --conf ./LocalSettings.php > >> > But it did not help either > >> > > >> > Thanks for your help! > >> > > >> > Kind regards > >> > Andreas > >> > > >> > _______________________________________________ > >> > Wikitech-l mailing list > >> > [email protected] > >> > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > >> > >> _______________________________________________ > >> Wikitech-l mailing list > >> [email protected] > >> https://lists.wikimedia.org/mailman/listinfo/wikitech-l > >> > > _______________________________________________ > > Wikitech-l mailing list > > [email protected] > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > > _______________________________________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
