Answer the question
In order to leave comments, you need to log in
How to change the output format of category parameters in Joomla component?
I am developing a component according to the articles of the standard Joomla documentation. I get a list of categories that belong to my component through a request, but I can't process data in json format from the 'params' field into a variable. How to parse a Json array into a regular view.
Below is the code for getting the list of categories:
public function getCatlist(){
if(!isset($this->catList)){
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select(array('title, description, params'))
->from('#__categories')
->where('extension = "com_mycomponent"')
->where('published = "1"');
$db->setQuery($query);
$this->catList = $db->loadObjectList();
}
return $this->catList;
}
stdClass Object ( [title] => Название категории [description] => Текст описания категории [params] => {"category_layout":"","image":"images\/image1.jpg","image_alt":""} )
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question