Hi, I am creating a tag extension that uses the categories of the current page. How can I get a list of all categories that are assigned on the page?
And I don't want the parent categories. I have found $wgPageTitle = $parser->getTitle(); $wgParentCats = $wgPageTitle->getParentCategories(); but it lists all the parent categories as well.
Thanks, Andi
Could you get the page text and parse out the category line? Might not be the most elegant solution though. -Courtney
-----Original Message----- From: wikitech-l-bounces@lists.wikimedia.org [mailto:wikitech-l-bounces@lists.wikimedia.org] On Behalf Of Andreas Rindler Sent: Wednesday, September 05, 2007 7:13 AM To: MediaWiki announcements and site admin list; wikitech-l@lists.wikimedia.org Subject: [Wikitech-l] Categories of current page
Hi, I am creating a tag extension that uses the categories of the current page. How can I get a list of all categories that are assigned on the page?
And I don't want the parent categories. I have found $wgPageTitle = $parser->getTitle(); $wgParentCats = $wgPageTitle->getParentCategories(); but it lists all the parent categories as well.
Thanks, Andi _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 9/5/07, Andreas Rindler mediawiki@jenandi.com wrote:
And I don't want the parent categories. I have found $wgParentCats = $wgPageTitle->getParentCategories(); but it lists all the parent categories as well.
Looking at the code, it doesn't LOOK like it gets all the parent categories, too.
$sql = "SELECT * FROM $categorylinks" ." WHERE cl_from='$titlekey'" ." AND cl_from <> '0'" ." ORDER BY cl_sortkey";
Correct me if I'm wrong..
Andrew Garrett wrote:
On 9/5/07, Andreas Rindler wrote:
And I don't want the parent categories. I have found $wgParentCats = $wgPageTitle->getParentCategories(); but it lists all the parent categories as well.
Looking at the code, it doesn't LOOK like it gets all the parent categories, too.
$sql = "SELECT * FROM $categorylinks" ." WHERE cl_from='$titlekey'" ." AND cl_from <> '0'" ." ORDER BY cl_sortkey";
Correct me if I'm wrong..
It's working. He answered on mediawiki-l (such crosspostings...) http://permalink.gmane.org/gmane.org.wikimedia.mediawiki/23224
yes, all sorted. thanks for your help.
On 06/09/07, Platonides Platonides@gmail.com wrote:
Andrew Garrett wrote:
On 9/5/07, Andreas Rindler wrote:
And I don't want the parent categories. I have found $wgParentCats = $wgPageTitle->getParentCategories(); but it lists all the parent categories as well.
Looking at the code, it doesn't LOOK like it gets all the parent categories, too.
$sql = "SELECT * FROM $categorylinks" ." WHERE cl_from='$titlekey'" ." AND cl_from <> '0'" ." ORDER BY cl_sortkey";
Correct me if I'm wrong..
It's working. He answered on mediawiki-l (such crosspostings...) http://permalink.gmane.org/gmane.org.wikimedia.mediawiki/23224
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org