[Mediawiki-l] Categories of current page

Thomas Dalton thomas.dalton at gmail.com
Wed Sep 5 13:23:35 UTC 2007


On 05/09/07, Andreas Rindler <mediawiki at jenandi.com> wrote:
> 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.

That should work, if I'm reading the code right. What do you mean by
"the parent categories"? It's listing the parents of the categories
the article is in? It should be listing just the parents of the
article, ie. which categories it is in, unless I'm seriously
misunderstanding the method.



More information about the MediaWiki-l mailing list