I created 3 custom fields for my joomla com_content articles like described in this tutorial: https://docs.joomla.org/Adding_custom_fields_to_core_components_using_a_plugin/de
Now i need to create an overview over all articles inside a category (43) and show these custom fields inside a joomla query.
My actual joomla query inside the template file override for articles:
<?php
$catId = 43;
$query = "SELECT * FROM #__content WHERE catid ='" . $catId . "'";
$db = JFactory::getDBO();
$db->setQuery($query);
$articles = $db->loadObjectList();
foreach($articles as $article){
echo 'ID: ' . $article->id;
echo '<br />';
echo 'Name: ' . $article->title;
echo '<br />';
echo '<a href="' . JRoute::_('index.php?option=com_content&view=article&id='.$article->id) . '">Link</a>';
echo '<br /><br />';
}
?>
Custom fields can be added to an article output with:
$this->params->get('custom_field_1');
But this is not working inside the loop. How can I add a custom field with the name custom_field_1 to this loop?