Example #1
0
 /**
  * Looks up all child categories for category with $id
  * and their children recursively, returning an array containing
  * strings that represent the category hierarchy.
  */
 public static function getChildrenCategoryStrings($id, $strings, $level)
 {
     jimport('joomla.application.categories');
     $children = JCategories::getInstance('Content')->get($id)->getChildren();
     for ($i = 0; $i < count($children); $i++) {
         // Append to array.
         $strings[] = array('title' => str_repeat('&nbsp;', $level) . $children[$i]->get('title'), 'id' => $children[$i]->get('id'));
         // Recursively add their children, too.
         $strings = modNavSliderHelper::getChildrenCategoryStrings($children[$i]->get('id'), $strings, $level + 1);
     }
     return $strings;
 }