tags:

views:

52

answers:

1

Hello,

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 !

+1  A: 

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).

DrDipshit
Ok thanks I'll give a try and feedback ;)
Kaaviar
Am I supposed to create a new module template ? I thought I could use a existing one...
Kaaviar
I'm not completely sure what you mean by create a new module template. If you mean add a new module position to your website template, then no. The code would render a module within another module - no need to specify a position for the inner module. You would however need to modify the code for your outer module, so if its being used elsewhere without the inner module you would probably want to add a module parameter specifying whether of not to display the inner module, then perform a check before adding the code I posted.
DrDipshit