A little under a year ago I wrote a blog post on how to 'Retrieve Plugin, Module, Component and Template Parameters in Joomla! 1.5'. At this moment, that blog is in our top 10 of most read blogs! Given this popularity and the number of comments that short blog received, it made sense to write a new version with information on how to get these parameters in Joomla! 1.7.

Image credits: edwin_young
$param = $this->params->get('paramName', defaultValue);
$plugin = JPluginHelper::getPlugin('editors', 'codemirror');
$pluginParams = new JRegistry();
$pluginParams->loadString($plugin->params);
$param = $pluginParams->get('paramName', 'defaultValue');
$param = $params->get('paramName', 'defaultValue');
$module = JModuleHelper::getModule('banners');
$moduleParams = new JRegistry();
$moduleParams->loadString($module->params);
$param = $moduleParams->get('paramName', 'defaultValue');
$app = JFactory::getApplication('site');
$componentParams = $app->getParams('com_content');
$param = $componentParams->get('paramName', defaultValue);
$app = JFactory::getApplication('site');
$componentParams = $app->getParams('com_example');
$param = $componentParams->get('paramName', defaultValue);
$param = $this->params->get('paramName', defaultValue);
$app = JFactory::getApplication('site');
$template = $app->getTemplate(true);
$param = $template->params->get('paramName', defaultValue);
Thanks to Peter for pointing this one out in the comments!
Buy 2 Templates, Get Your Third Free!
By popular demand we've introduced a way to purchase multiple templates, at a discounted rate! If you add any three templates to your shopping cart, you'll only have to pay for two!
Upcoming conferences
Past conferences
0 items
View cart