Joomlaスクリプトの外部を使用しており、モジュールのパラメーターを取得する必要があります。
Joomla 2.5ではコードは正常に機能していましたが、j3では問題があります。
コードは次のとおりです。
define( '_JEXEC', 1 );
define('JPATH_BASE', getcwd().'/../../');
require_once ( JPATH_BASE.'includes/defines.php' );
require_once ( JPATH_BASE.'includes/framework.php' );
/* Create the Application */
$app = JFactory::getApplication('site');
jimport( 'joomla.application.module.helper' );
$module = &JModuleHelper::getModule( 'mod_mailformmodule');
var_dump($module);
そして私は得る:
object(stdClass)#43 (8) {
["id"]=>
int(0)
["title"]=>
string(0) ""
["module"]=>
string(18) "mod_mailformmodule"
["position"]=>
string(0) ""
["content"]=>
string(0) ""
["showtitle"]=>
int(0)
["control"]=>
string(0) ""
["params"]=>
string(0) ""
}
「params」フィールドが空の文字列である理由を誰かが持っている場合、私は感謝しています。
ありがとうございました。
モジュールが必要な基準を満たしていない可能性があります。確認してください:
私は以下をテストしました:
define( '_JEXEC', 1 );
define('JPATH_BASE', getcwd().'/../../');
require_once ( JPATH_BASE.'includes/defines.php' );
require_once ( JPATH_BASE.'includes/framework.php' );
/* Create the Application */
$app = JFactory::getApplication('site');
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'mod_login' );
$registry = new JRegistry();
$params = $registry->loadString($module->params);
print_r($params);
これは、Joomla 3.xライブラリをインポートし、ログインモジュールオブジェクトを取得する外部スクリプトです。すべてが完璧に機能します。