I want to create a module for joomla 3.1 for my own site. I need to know how to get current category id, parent category id, current page id. Please some one tell me how to do that. Thanks for your advance
going from memory here, please bear with some inaccuracies but it should be enough to get you going.
$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');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With