I need to add EasySocial routing to my own component, so that JRoute([some EasySocial link]) outputs a proper EasySocial URL.

How can I do that? If I understand correctly, EasySocial routing is active only and only while I'm on the EasySocial component - I just need to make that routing available for my own component.

1 Answer 1


It appears EasySocial requires menu item ID to be appended to the non-SEF URL passed to JRoute::_() call. There is ESR::getItemId() method that can retrieve the menu item ID of a given view. So something like this could work:

JRoute::_('index.php?option=com_easysocial&view=albums&Itemid=' . ESR::getItemId('albums'))

However, the most common way is to use magic static methods of ESR class. This is what EasySocial and the included modules generally used. The method name is the view and it accepts an array of arguments:

ESR::albums(['layout' => 'default', 'id' => $someId]);

Before you can use EasySocial classes, you need to load easysocial.php file:

$engine = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php';

if (!is_file($engine)) {
    // EasySocial is not installed, return early or use some fallback code

require_once $engine;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.