How to add tags in the template of mod_tags_similar? I add custom fields and other data by this code
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('core_content_id', 'core_content_item_id', 'core_images', 'core_title', 'core_alias', 'core_created_time', 'core_catid')))
->from($db->quoteName('#__ucm_content'))
->where($db->quoteName('core_content_id') . ' IN (' . implode(',', array_column($list, 'core_content_id')) . ')');
$extraData = $db->setQuery($query)->loadObjectList('core_content_id');
$ItemDataArray = json_decode(json_encode($extraData), true);
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel');
$field = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true));
<?php foreach ($ItemDataArray as $ItemData) : ?>
<?php
echo $field->getFieldValue(29, $ItemData['core_content_item_id']),true;
?>
<?php endforeach; ?>
Maybe there is a way to add tags in this way?
json_decode(json_encode($objectArray), true)
to form an array of arrays, just use Joomla'sloadAssocList()
docs.joomla.org/… oh... and that trailing,true
on that lastecho
looks out of place. I won't be posting an answer, because I don't know how to resolve your question.