Getting Page Properties and Parameters in Joomla

Getting the Application object.

//In Joomla 1.5 you can use the global $mainframe object.
//if your using $mainframe from within a function need to define it as global
global $mainframe;

//As of Joomla 1.6 the $mainframe global will no longer be available. You will need to instantiate it like this.
$mainframe = JFactory::getApplication();

Getting page parameters:

$params =& $mainframe->getParams();
$title = $params->get(‘page_title’);
$desc = $params->get(‘page_description’);

Getting page parameters and menu item properties from menu object:

$menus = &JSite::getMenu(); //returns JMenuSite object
$menu= $menus->getActive(); //gets current page menu item properties

//retrieve view layout menu item parameters
$params = new JParameter( $menu->params ); 
$title = $params->get('show_title');
$contest = $params->get('contest_id');

//retrieve menu item parameters
$mID = $menu-&gtid; //menu item id
$route = $menu->route; //page sef url path
$qry = $menu->link; //query string
$alias = $menu->alias; //menu item alias
$comp = $menu->component; //component
$opt = $menu->query[‘option’]; //component
$id = $menu->query[‘id’]; //article id
$cid = $menu->query[‘cid’]; //category id
$view = $menu->query[‘view’]; //view

Get Global Config Parameters:

$mainframe->getCfg( 'sitename' );

Get global parameters of a component:

$params = $mainframe->getParams('com_content');
$val = $params->get('paramname');

//also do it this way using component helper class 
$params = &JComponentHelper::getParams('com_content');
$val = $params->get('paramname');

Get Template name being used for current page:


Leave a comment


  1. This is an excellent reference. Thanks for posting this, Andy!

    Kind regards,

  2. hey thanks for the above code reference but can we get layout parameter from url.
    JRequest is deprecated so how i can get that variable ?