我想为我自己的网站创建一个joomla 3.1模块。我需要知道如何获取当前类别ID,父类别ID,当前页面ID。请有人告诉我该怎么做。谢谢你的提前
答案 0 :(得分:17)
从记忆中走出来,请承担一些不准确之处,但它应该足以让你前进。
$input = JFactory::getApplication()->input;
// should be article, categories, featured, blog...
$view = $input->get('view');
// if it's a category view, this will be the category id, else the article id
$id = $input->getInt('id');
// in an article view, this will be the cat id.
$catid = $input->getInt('catid');
// this is the menu item id i.e. what you call page id I guess.
$Itemid = $input->getInt('Itemid');