Joomla Get subcategories of custom parent category

joomla, joomla2.5, joomla3.1

Solution

`getChildren` is not a static function, you call it off the category object that you get from `get`, which should be of type JCategoryNode.

$catID = JRequest::getVar('id');
$categories = JCategories::getInstance('Content');
$cat = $categories->get($catID);
$children = $cat->getChildren();
print_r($children);

JCategorNode api

Problem

I have a category ID and wan't to display all the subcategories. Show should I do that in Joomla? I've tried the following ``` $catID = JRequest::getVar('id'); $categories = JCategories::getInstance('Content'); $cat = $categories->get($catID); $children = JCategoryNode::getChildren($cat); printObject($children); ``` But it doesn't work.

Original source