I'm programming a module in Joomla! 2.5. The module displays an article at a given position.
I need article attributes (i.e. show_title
, link_title
ecc.)
With this code I get article's specific attributes:
$db =& JFactory::getDBO();
$query = 'SELECT * FROM #__content WHERE id='.$id.' AND state=1';
$db->setQuery($query);
$item = $db->loadObject();
$attribs = json_decode($item->attribs, true);
If i var_dump
the $attribs
variable I get:
array(26) {
["show_title"]=>
string(0) ""
["link_titles"]=>
string(0) ""
[...]
}
The variable $attribs
represents the article's specific attributes. When an element is set to ""
means "use the global configuration".
I can get the global configuration with this query:
SELECT params from #__extensions where extension_id=22;
Where 22 is the id of the com_component
extension. Then I can merge the results here with the results for the specific article.
BUT is there an easy way to achieve this? Does Joomla! have a specific class in the framework for this?