Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Get Current Page Parameters And Properties of Joomla 3.1

Tags:

joomla

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

like image 794
Ibnu Syuhada Avatar asked Dec 02 '22 18:12

Ibnu Syuhada


1 Answers

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'); 
like image 182
Riccardo Zorn Avatar answered Dec 15 '22 06:12

Riccardo Zorn