Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how we get a module parameter in a component view in joomla

Tags:

joomla

How do I get the module parameter inside a component in Joomla 1.5? I am using this code but it displays an empty result.

jimport( 'joomla.application.module.helper' );
$module = &JModuleHelper::getModule( 'mod_used_car_image');

$params = new JParameter($module->params);

print_r($params);
like image 524
Maneesh Mehta Avatar asked Sep 01 '12 10:09

Maneesh Mehta


2 Answers

I got the params value. Use this code to get it:

jimport( 'joomla.html.parameter' );
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_name');
$moduleParams = new JRegistry();
$moduleParams->loadString($module->params);
$position = $moduleParams->get('position', '1');
like image 76
Veera Avatar answered Oct 18 '22 23:10

Veera


You need to call the 'name' of your module, not the 'type' of module.

Let's say you named your module 'Used Car Image', your code should be:

jimport( 'joomla.application.module.helper' );
$module = &JModuleHelper::getModule( 'Used Car Image');

$params = new JParameter($module->params);

print_r($params);

Here's the manual:

http://docs.joomla.org/JModuleHelper/getModule

like image 39
seavers Avatar answered Oct 19 '22 00:10

seavers