1

外部PHPファイルで無効化されたJoomlaモジュールからパラメータをロードすることは可能ですか?

4

1 に答える 1

0
$module = &JModuleHelper::getModule('example'); //Get the module (in this case "example")
$moduleParams = new JParameter($module->params); //Retrieve this modules parameters
$param = $moduleParams->get('paramName', 'defaultValue'); //Get the specific parameter

このコードは、無効になっているかどうかに関係なく、記事のパラメーターを取得する必要があります。Joomlaの外部にあるという点で外部のphpファイルである場合は、次を使用してJoomlaクラスをロードする必要もあります。

//init Joomla Framework
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define( 'JPATH_BASE', realpath(dirname(__FILE__).DS.'..'.DS.'..'.DS.'..'));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe = JFactory::getApplication('site');

詳しくはこちら

于 2012-11-12T13:59:48.743 に答える