私はJoomlaで作業するのが初めてで、私はv1.5用に書いた外部PHPクラスを採用しています。 基本的には、Joomlaの環境をすべて読み込んで、Joomlaのすべてをクラスに利用できるようにするために、基本的にすべての詳細を説明しません。 これは基本的にindex.phpファイルを使用して行われます。Joomla 1.6外部PHPインタラクションの問題
これはv1.5でうまく動作し、しばらくの間行っていますが、v1.6に適応しようとすると落ちます。ここで
は関数である。
private function loadJoomla() {
$path_base = rtrim($this->joomFullPath, '/');
// Set flag that this is a parent file
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
switch ($joomlaVersion) {
case 'v1.6':
if (file_exists($path_base . '/defines.php')) {
include_once $path_base . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', $path_base);
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;
// Instantiate the application.
$app = JFactory::getApplication('site');
// Initialise the application.
$app->initialise();
// Mark afterIntialise in the profiler.
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
// Route the application.
$app->route();
// Mark afterRoute in the profiler.
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
// Dispatch the application.
$app->dispatch();
// Mark afterDispatch in the profiler.
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
// Render the application.
$app->render();
// Mark afterRender in the profiler.
JDEBUG ? $_PROFILER->mark('afterRender') : null;
// Return the response.
return $app;
break;
case 'v1.5':
// PREPARE
define('JPATH_BASE', $path_base);
require_once (JPATH_BASE .DS.'includes'.DS.'defines.php');
require_once (JPATH_BASE .DS.'includes'.DS.'framework.php');
JDEBUG ? $_PROFILER->mark('afterLoad') : NULL;
// CREATE THE APPLICATION
$GLOBALS['mainframe'] =& JFactory::getApplication('site');
// INITIALISE THE APPLICATION
/* set the language */
$GLOBALS['mainframe']->initialise();
JPluginHelper::importPlugin('system');
/* trigger the onAfterInitialise events */
JDEBUG ? $_PROFILER->mark('afterInitialise') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterInitialise');
// ROUTE THE APPLICATION
$GLOBALS['mainframe']->route();
/* authorization */
$GLOBALS['Itemid'] = JRequest::getInt('Itemid');
$GLOBALS['mainframe']->authorize($GLOBALS['Itemid']);
/* trigger the onAfterRoute events */
JDEBUG ? $_PROFILER->mark('afterRoute') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterRoute');
// DISPATCH THE APPLICATION
$GLOBALS['option'] = JRequest::getCmd('option');
$GLOBALS['mainframe']->dispatch($GLOBALS['option']);
/* trigger the onAfterDispatch events */
JDEBUG ? $_PROFILER->mark('afterDispatch') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterDispatch');
// RENDER THE APPLICATION
$GLOBALS['mainframe']->render();
/* trigger the onAfterRender events */
JDEBUG ? $_PROFILER->mark('afterRender') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterRender');
// RETURN THE RESPONSE
return JResponse::toString($GLOBALS['mainframe']->getCfg('gzip'));
break;
default:
return NULL;
break;
}
としては、V1.5ビットが正常に動作し、グローバル製メインフレームの変数を持つだけでindex.phpファイルである、と述べました。 v1.6ビットは '$ app-> dispatch();'に落ちます。
'die'を使用してフローをデバッグすると、/libraries/joomla/application.phpに関数ディスパッチされました。ここで、fall overポイントが '$ contents = JComponentHelper :: renderComponent($ component);'私が関数にかかったのは、/libraries/joomla/application/component/helper.phpの
です。後でいくつか「死んでしまいます」、私は落ち着きがあることがわかりました、「ob_start();」。 特にv1.5コードをチェックインして以来、完全に困惑していましたが、ここではv1.6とまったく同じです。
私は$ appスコープがこれの背後にある理由であると思われ、助けに感謝します。私は明らかな "$ GLOBALS ['app']"を喜んで試しました。
時間とポインタをいただきありがとうございます。
私は知っているすべてを試して、この同じ質問を他の場所で尋ねましたが、たびに私は沈黙の壁で会いました。私はこれを引き起こす原因をどのように表現しているのかについて何かがあるのだろうかと思います。可能であればお手伝いください。ありがとう – Dayo