Reputation: 4142
I got the article ID and category ID but couldn't get the parent category ID.
How do I proceed?
Article ID:
<?php $id = (int)JRequest::getVar('id'); echo $id; ?>
Category ID:
<?php $catid = JRequest::getInt('catid'); echo $catid; ?>
I want to find out the parent-Category ID.
Upvotes: 1
Views: 2420
Reputation: 7059
If you looking for parent category id of a category then you can try this -
$category = JTable::getInstance('category');
$category->load($catid);
echo $category->parent_id;
Upvotes: 3