Maneesh Mehta
Maneesh Mehta

Reputation: 507

how we get a module parameter in a component view in 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);

Upvotes: 7

Views: 4848

Answers (3)

Jack Wang
Jack Wang

Reputation: 51

$module = JModuleHelper::getModule('modulename');
$params = new JRegistry($module->params);
var_dump($params);

That's how to use after joomla 3.0

Upvotes: 0

Veera
Veera

Reputation: 31

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');

Upvotes: 3

seavers
seavers

Reputation: 571

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

Upvotes: 1

Related Questions