function getItemRoute($id, $catid = 0, $Itemid = 0, $item = null)
function getCategoryRoute($catid, $Itemid = 0, $urlvars = array())
Above are the functions signatures that create the FLEXIcontent links to
-- items
-- categories
which are then converted to SEF link by passing it through JRoute::_(...)
-- $id is the (content) item id and
-- $catid is the category id and
-- $Itemid is optional and can be used to activate any FLEXIcontent menu item
-- $item is optional and is the item object, and recommend for best SEF URLs,
it must have at least: $item->language and (optionally) $item->type_id
So final code to use in your code is:
// Create an FC item link and then convert to SEF link
$link = JRoute::_( FlexicontentHelperRoute::getItemRoute($id, $catid=0, $Itemid=0, $item=null) );
// Create an FC category link and then convert to SEF link
$link =JRoute::_( FlexicontentHelperRoute::getCategoryRoute($catid, $Itemid=0) );
echo '<a href="'.$link.'">Some text</a>
If the above are need outside of FLEXIcontent component/modules/plugins then you also need to include these files:
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'defineconstants.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'helpers'.DS.'route.php');
Also note that normally/usually we do not set this 3rd parameter for getItemRoute(...).
In this case we let the function decide the "optimal" which is from high to low priority menu item that are:
1. MATCH menu itemid: FC item id + FC category id
2. MATCH menu itemid: FC item id
3. MATCH menu itemid: FC category id
4. MATCH menu itemid: the CURRENT menu itemid, if it points to FC
5. What the global configuration option suggests (e.g. a chosen in global configuration item id or no itemid at all)