Skip to main content
added 202 characters in body
Source Link
Sharky
  • 12.8k
  • 9
  • 24

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.

Use factory to get site application:

$app = JFactory::getApplication('site');

Also looks like ContentHelperRoute is missing. You have import it:

JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

The strict standards can be solved by removing the ampersand before getRouter() call:

$router = $app->getRouter();

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.

Use factory to get site application: 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');

    // Get site router.
    $router = JFactory::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.

added 93 characters in body
Source Link
Sharky
  • 12.8k
  • 9
  • 24

LooksUse factory to get site application:

$app = JFactory::getApplication('site');

Also looks like ContentHelperRoute is missing. You have import it:

JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

The strict standards can be solved by removing the ampersand before getRouter() call:

$router = $app->getRouter();

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.

Looks like ContentHelperRoute is missing. You have import it:

JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

The strict standards can be solved by removing the ampersand before getRouter() call:

$router = $app->getRouter();

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.

Use factory to get site application:

$app = JFactory::getApplication('site');

Also looks like ContentHelperRoute is missing. You have import it:

JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

The strict standards can be solved by removing the ampersand before getRouter() call:

$router = $app->getRouter();

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.

Source Link
Sharky
  • 12.8k
  • 9
  • 24

Looks like ContentHelperRoute is missing. You have import it:

JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');

The strict standards can be solved by removing the ampersand before getRouter() call:

$router = $app->getRouter();

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.