/** * Looks up all child categories for category with $id, * appends them to $ids array and recursively looks up * their children, too. */ public static function getChildrenCategoryIds($id, $ids) { jimport('joomla.application.categories'); $children = JCategories::getInstance('Content')->get($id)->getChildren(); for ($i = 0; $i < count($children); $i++) { // Append to array. $ids[count($ids)] = $children[$i]->get('id'); // Recursively add their children, too. $ids = modNavSliderHelper::getChildrenCategoryIds($ids[count($ids) - 1], $ids); } return $ids; }