在外部PHP文件中加载Joomla 3.x框架和模块

Odd*_*ddy 5 php joomla phpbb phpbb3 joomla3.0

我正在将我的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');
Run Code Online (Sandbox Code Playgroud)

但我现在不在Joomla 3.x工作.页面停止加载此代码所在的位置.在安全选项中启用了在phpbb模板文件中使用PHP.

有谁知道如何在外部文件中加载joomla 3.x框架?

Lod*_*der 10

以下适用于我:

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');
Run Code Online (Sandbox Code Playgroud)

尝试将您当前拥有的此行更改为相对路径,如上所示.您可能会../根据您的Joomla根与外部文件的位置进行更改.

define('JPATH_BASE', '/var/customers/webs/tf2swiss/joomlasite');
Run Code Online (Sandbox Code Playgroud)

要测试它是否正常工作,只需使用以下内容:

var_dump($app);
Run Code Online (Sandbox Code Playgroud)

如果您看到显示的数据,那么您已成功导入框架