The following code is in an event handler for the onContentAfterSave event for my plugin. &$article is one of the parameters passed in.
Code: Select all
$article_link = JURI::base().JRoute::_(ContentHelperRoute::getArticleRoute($article->id,$article->catid));
Code: Select all
Class 'ContentHelperRoute' not found
Thanks in advance,
Bruce
Edit: Something just hit me while I was typing that. On the site it is working, I was editing my article on the site front end and on the other I was editing on the back end. So I tried editing the article in the back end on both sites and the error occurs on both sites in that case. So it would seem that class ContentHelperRoute is not being loaded when in the admin back end of the site. Interesting. Is that something that should be fixed in the core or should my plugin be doing something to prevent it?
I added the following line to prevent this error, but this is not needed if the article is being edited on the site front end. This prevents the error from occurring, but now the generated link is completely wrong.
Code: Select all
if(!class_exists('ContentHelperRoute')) require_once (JPATH_SITE . '/components/com_content/helpers/route.php');