I've got a custom component I am focusing on and I am writing an import script that is running within the administration area. I've the next code:

$newUrl = ContentHelperRoute::getArticleRoute($import->article_id.':'.$import->alias, $import->catid);
$newUrl = JRoute::_($newUrl);

part one works coming back similiar for this:


the 2nd part shows it such as this:


Both of the aforementioned web addresses are as you'd expect the component com_content to render these web addresses as though I needed for their services inside the administration area.

Any idea how you can pressure JRoute to operate because it would when utilized in the frontend?

NB: This really is getting used inside a controller of my component, whether it makes any difference and I am including require_once (JPATH_SITE . '/components/com_content/assistants/route.php')

For individuals who find this on the internet and have a problem with using JRoute::_() and contentHelper::getArticleRoute().

$newUrl = ContentHelperRoute::getArticleRoute($import->article_id.':'.$import->alias, $import->catid);

// better will be check if SEF option is enable!
$router = new JRouterSite(array('mode'=>JROUTER_MODE_SEF));
$newUrl = $router->build($newUrl)->toString(array('path', 'query', 'fragment'));
// SEF URL !
$newUrl = str_replace('/administrator/', '', $newUrl);
//and now the tidying, as Joomlas JRoute makes a cockup of the urls.
$newUrl = str_replace('component/content/article/', '', $newUrl);