How to get all parent categories in joomla?
I've tried the following:
//get the Category Content Object
jimport( 'joomla.application.categories' );
$categories = JCategories::getInstance('Content');
$cid = urldecode(JRequest::getString('cid'));
$i=0;
$catid[$i] = $cid;
while ($catid[$i] != "root") {
$cat = $categories->get($catid[$i]);
$i++;
$catid[$i]= $cat->parent_id;
}
var_dump($catid);
But it doesn't work.
Notice: Trying to get property of non-object in E:\xamppppp\htdocs\**\**.php on line 56
array(2) { [0]=> string(2) "20" [1]=> NULL }
!=
to!==