[英]Get Joomla parent-category ID
I got the article ID and category ID but couldn't get the parent category ID. 我得到了文章ID和类别ID,但无法获得父类别ID。
How do I proceed? 我该怎么办?
Article ID: 文章ID:
<?php $id = (int)JRequest::getVar('id'); echo $id; ?>
Category ID: 类别ID:
<?php $catid = JRequest::getInt('catid'); echo $catid; ?>
I want to find out the parent-Category ID. 我想找出父类别ID。
If you looking for parent category id of a category then you can try this - 如果您要查找某个类别的父类别ID,那么您可以尝试这个 -
$category = JTable::getInstance('category');
$category->load($catid);
echo $category->parent_id;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.