Use factory to get site application:
$app = JFactory::getApplication('site');
Also looks like ContentHelperRoute is missing. You have import it:. The strict standards can be solved by removing the ampersand before getRouter() call.
public static function getUrl()
{
// Register required classes.
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
The strict standards can be solved by removing the ampersand before getRouter() call:
// Get site router.
$router = $appJFactory::getApplication('site')->getRouter('site');
// Build URI object.
$url = $router->build(ContentHelperRoute::getCategoryRoute('10'));
return $url->toString();
}
i have also tried
JRoute::_(ContentHelperRoute::getCategoryRoute('10'));
It just throws error saying failed to start application.
JRoute::_() will not work in CLI because it's based on current application and CLI doesn't have a router. JRoute::link() should work but, apparently, it has the same issue at the moment.