Load Joomla 3.x Framework and Modules in external PHP file -
i migrating joomla 2.5 site joomla 3.3.
now i'm struggling loading joomla framework , displaying module in phpbb-template. loading joomla framework worked fine in joomla 2.5 code:
define( '_jexec', 1 ); define('jpath_base', '/var/customers/webs/tf2swiss/joomlasite'); define( 'ds', directory_separator ); require_once('../configuration.php'); require_once ( jpath_base .ds.'includes'.ds.'defines.php' ); require_once ( jpath_base .ds.'includes'.ds.'framework.php' ); require_once ( jpath_base .ds.'libraries'.ds.'joomla'.ds.'factory.php' ); require( jpath_libraries. '/import.php'); // joomla! library imports jimport( 'joomla.environment.uri' ); jimport( 'joomla.user.user'); jimport('joomla.application.module.helper'); /* create application */ $mainframe =& jfactory::getapplication('site'); jimport('joomla.plugin.helper');
but doesn't work in joomla 3.x now. page stopps loading code is. using php in phpbb template files enabled in security options.
does know how load joomla 3.x framework in external files?
the following works me:
define('_jexec', 1); define('jpath_base', '../'); require_once jpath_base . 'includes/defines.php'; require_once jpath_base . 'includes/framework.php'; // create application $app = jfactory::getapplication('site');
try changing line have relative path shown above. may been change ../
according have joomla root in relation external file.
define('jpath_base', '/var/customers/webs/tf2swiss/joomlasite');
to test if it's working, use this:
var_dump($app);
if see data being shown, have imported framework
Comments
Post a Comment