[Mediawiki-l] getParentCategoryTree()

a@kid a at kid632.org
Fri May 19 20:32:45 UTC 2006


I am trying to find the most efficient way to get a list of all the  
categories that make up the category tree for an article. So if an  
article belongs to Category x and Category x belongs to Category y  
and z ,  i want to get the list:  x, y, z

I assumed that getParentCategoryTree() would do just that ... But it  
is only returning a title's parent categories not the entire category  
tree. So in the above case it is only returning 'x' instead of x, y, z.

I am using the following:

$CategoryTree = $wgTitle->getParentCategoryTree();
	foreach ($CategoryTree as $key => $value){
		$nt = Title::newFromText($key);
		$category list .= $nt->getText();
	}


Am I misunderstanding the purpose of getParentCategoryTree() ?
If so, is there another way of getting the list of categories i am  
looking for?

Thanks in advance
for any help you can give




More information about the MediaWiki-l mailing list