Sunday 17 February 2013

Joomla 2.5, using JRegistry to extract the parameters of the categories.

The parameters of the categories can be easily extracted by the following method.



First of all, import the main registry class by,



 jimport( 'joomla.registry.registry' );

after that call the values of the categories as follows.
$query = "SELECT * FROM #__categories where parent_id != 1 ORDER BY id desc ";
$db = &JFactory::getDBO();
$db->setQuery($query);
$rowsc = $db->loadObjectList();
foreach($rowsc as $rowc)
{

}

then ,  in order to get the parameters, put the following code inside braces.

$par=$rowc->params;
$params = new JRegistry;
$params->loadJSON($par);

$image = $params->get('image');



and thats it

No comments:

Post a Comment