You can use the following code to retrieve and display item data (item fields HTML display) inside your custom code:
//include constants file require_once (JPATH_ADMINISTRATOR.DS.'components/com_flexicontent/defineconstants.php'); JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'tables'); require_once(JPATH_SITE.DS."components/com_flexicontent/classes/flexicontent.fields.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/classes/flexicontent.helper.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/helpers/permission.php"); require_once(JPATH_SITE.DS."components/com_content/helpers/route.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/helpers/route.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/models/".FLEXI_ITEMVIEW.".php"); // CHANGE THIS !!! $item_arr = array(445,567); // myfunction_to_get_item_ids; $itemmodel_name = FLEXI_J16GE ? 'FlexicontentModelItem' : 'FlexicontentModelItems'; $itemmodel = new $itemmodel_name(); foreach( $item_arr as $item_id ) { $item = $itemmodel->getItem($item_id, $check_view_access=false); $item_link = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug)); $items = array(&$item);
// Get fields values from the DB, FlexicontentFields::getFields($items); // now you can use $item->fieldvalues[field_id] for the raw field values (DB value) of any field
//or call FlexicontentFields::getFieldDisplay($item, 'field_name') to render the display of any field
FlexicontentFields::getFieldDisplay($item, 'voting'); FlexicontentFields::getFieldDisplay($item, 'hits'); FlexicontentFields::getFieldDisplay($item, 'tags'); // Get fields label and their HTML display, you can output these as needed $voting_label = $item->fields['voting']->label; $voting = $item->fields['voting']->display; $hits = $item->fields['hits']->display; $hits_label = $item->fields['hits']->label; $tags = $item->fields['tags']->display; $tags_label = $item->fields['tags']->label; echo $hits_label.": ".$hits." , "; echo $tags_label.": ".$tags." , "; }
We also plan for supporting retieval of item fields at any place of the joomla page, via a plugin e.g. {fcitem:current##field:hits} OR {fcitem:455##field:hits} ALSO read this article:
-- Retrieving item title and other fields for use in RSforms