0
votes

I have a site, which is being built with Joomla 2.5, and this site has to be integrated with another application built in some other Framework(which is not of our concern).

the Joomla site/frontend is accessible by the following URL http://wwww.server.com/

The application is kept under http://wwww.server.com/app/

I am trying to re-create the Menu defined in Joomla Admin, into the applications sidebar, using the following code snippet

define( '_JEXEC', 1 );
define('JPATH_BASE', realpath(dirname(__FILE__)."/../"));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModules('left');
echo JModuleHelper::renderModule($module[0]);

This generates the Menu perfectly on the non-Joomla page, but the URL generated for the HREF attribute contains /app/ included in it, which should not have been there

1

1 Answers

0
votes

After a fair amount of digging into the routes, uri, etc files, I have added a dirty fix/hack into the code mentioned above to generate the correct menu URLs:

define( '_JEXEC', 1 );
define('JPATH_BASE', realpath(dirname(__FILE__)."/../"));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$JConfig=JFactory::getConfig();
$JConfig->set('live_site','http://www.server.com/');
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModules('left');
echo JModuleHelper::renderModule($module[0]);

I have tried here to set the 'live_site' configuration to the site's base url in my case.

I hope this helps out someone.