Question

I want to get the module params in component area in joomla 2.5

Here my code :

jimport( 'joomla.application.module.helper' );
$module = &JModuleHelper::getModule('mod_module');
$moduleParams = new JParameter($module->params);
print_r( $moduleParams );

I try to print the $moduleParams...Its display nothing.
I got this code from the website http://www.themepartner.com/blog/25/retrieving-plugin-module-component-and-template-parameters/

Is there anyother way to get the params using the module name.

Was it helpful?

Solution 3

I found the mistake

here the correct code

jimport( 'joomla.application.module.helper' );
jimport( 'joomla.html.parameter' );
$module = &JModuleHelper::getModule('mod_randomads');
$moduleParams = new JParameter($module->params);

Problem is jimport( 'joomla.html.parameter' ); is missed

OTHER TIPS

for joomla 1.6 and higher

 jimport( 'joomla.application.module.helper' ); 
    $module = JModuleHelper::getModule('mod_name');
    $moduleParams = new JRegistry();
    $moduleParams->loadString($module->params);
    $param = $moduleParams->get('paramName', 'defaultValue'); 

Hope this help cause jparameter is deprecated in j1.5 higher

You missed the actual link i think for 1.7 is http://www.themepartner.com/blog/56/get-joomla-17-plugin-module-component-and-template-parameters/

For Joomla 3 you just need to do:

$module = JModuleHelper::getModule('mod_name');
$moduleParams = new JRegistry($module->params);
$param = $moduleParams->get('param_name', 'default_value');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top