DrDigital wrote:I got a trickier one... How do I load a module thats got advanced parameters and alternative layouts?
I got the module showing... but its not the correct view
I had the same question - so I looked at the JModuleHelper class in:
..and if you check out the function that renders the module - the one you are calling passing it the $module - you'll find this line:
// Get module parameters
$params = new JParameter( $module->params );
So I thought well, I'll give you the params on the module object - but the tricky thing is: what is $params should be array? object? ... o I opened the JParameter class and as it seems to me the only way is to pass it the raw params as a string where each key=value pairs are separated by a newline "\n"
And it works!
Maybe there are other ways but this is quite easy - here is the code:
Code: Select all
$module = JModuleHelper::getModule('mod_mymodule','MY MODULE NAME');
$mP = array();
$mP = "moduleParamName1=value1";
$mP = "moduleParamName2=value2";
$mP = "moduleParamName3=value3";
$module->params = implode("\n", $mP);
$moduleHtml = JModuleHelper::renderModule($module);
The know what are the names and values that you can use for a certain module, open its xml file (u know that).
BTW - this is J!1.5 stuff - I'm still stuck here