I'm an absolute beginner using Joomla. I'm trying to load a module within another module but I can't find how to do this. I've been trying adding
{loadposition position}
with "position" replaced the position of the module I'd like to be loaded but it seems to work only in articles.
I've found another solution here : http://forum.joomla.org/viewtopic.php?p=1531754&sid=bae9b487983c7e8a9f9c4fbd2958cf52#p1531754
but I don't know where to put this PHP code in my module.
Thanks for helping !
You need to manually add the code to render your inner module to your container module. Heres an example:
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mainmenu');
$attribs['style'] = 'xhtml';
echo JModuleHelper::renderModule( $module, $attribs );
Taken from:
http://docs.joomla.org/JModuleHelper/renderModule
To display the output you would need to place the code in the section of your outer module source that you want the html to be rendered.
Where you would replace 'mainmenu' with the name of the module that you want to embed. (I removed the second param, as I'm assuming you don't want to display a title).
If you need to bring another module other than the menu (every where always show you a module)
This is my trick: (works in 2.5 and 3.0)
Go to your module and create a fake position only for this like "oehelp" in this case.
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style'=>'raw');
echo $renderer->render('oehelp',$options,null);
voila,
saludos