ブログエントリからの抜粋を追加しました:
プラグイン内からのプラグインパラメータ
$param = $this->params->get('paramName', 'defaultValue');
プラグインの外部からのプラグインパラメータ
$plugin = &JPluginHelper::getPlugin('exampleType', 'example');
$pluginParams = new JParameter($plugin->params);
$param = $pluginParams->get('paramName', 'defaultValue');
モジュール内からのモジュールパラメータ
$param = $params->get('paramName', 'defaultValue');
モジュール外部からのモジュールパラメータ
$module = &JModuleHelper::getModule('example');
$moduleParams = new JParameter($module->params);
$param = $moduleParams->get('paramName', 'defaultValue');
コンポーネント内部からのコンポーネントパラメータ
$componentParams = &JComponentHelper::getParams('com_example');
$param = $componentParams->get('paramName', 'defaultValue');
コンポーネントの外部からのコンポーネントパラメータ
$componentParams = &JComponentHelper::getParams('com_example');
$param = $componentParams->get('paramName', 'defaultValue');
テンプレート内からのテンプレートパラメータ
$param = $this->params->get('paramName');
テンプレートの外部からのテンプレートパラメータ
jimport('joomla.filesystem.file');
$mainframe = &JFactory::getApplication();
$params = $mainframe->getParams(JFile::read(JURI::root() .'/templates/template_name/params.ini'));
$param = $params->get('paramName', 'defaultValue');
Joomlaフレームワーク外のインクルードファイルからのテンプレートパラメータ
// Get params.ini relative to the current file location (use your own relative path here)
$paramsFile = dirname(__FILE__) . '/../../params.ini';
// Only continue if the file exists
if(file_exists($paramsFile)) {
// Get contents from params.ini file
$iniString = file_get_contents($paramsFile);
// Escape double quotes in values and then double-quote all values (because Joomla doesn't do that for us..)
$iniQuoted = preg_replace('/=(.*)\\n/', "=\"$1\"\n", addcslashes($iniString, '"'));
// Parse the ini string to an associative array
$iniParsed = parse_ini_string($iniQuoted);
} else {
$iniParsed = '';
}
// Set params to obtained values or empty array
$params = (!empty($iniParsed)) ? $iniParsed : array();
// Get param value from array
$param = $params['paramName'];