我正在将我的Joomla 2.5网站迁移到Joomla 3.3。
现在,我正在努力加载joomla框架并在phpbb-Template中显示一个模块。使用以下代码加载Joomla框架在Joomla 2.5中运行良好:
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 the Application */
$mainframe =& JFactory::getApplication('site');
jimport('joomla.plugin.helper');但我现在不在Joomla 3.x中工作。页面停止加载此代码所在的位置。在安全选项中启用在phpbb模板文件中使用PHP。
有人知道如何在外部文件中加载joomla 3.x框架吗?
发布于 2014-05-30 00:09:05
下面的代码非常适合我:
define('_JEXEC', 1);
define('JPATH_BASE', '../');
require_once JPATH_BASE . 'includes/defines.php';
require_once JPATH_BASE . 'includes/framework.php';
// Create the Application
$app = JFactory::getApplication('site');尝试将您当前拥有的这一行更改为一个相对路径,如下所示。您可以根据Joomla根目录相对于外部文件的位置来更改../。
define('JPATH_BASE', '/var/customers/webs/tf2swiss/joomlasite');要测试它是否正常工作,只需使用如下代码:
var_dump($app);如果您看到显示的数据,则表示您已成功导入框架
https://stackoverflow.com/questions/23937651
复制相似问题