在Joomla中的另一个模块中加载一个模块

问题描述:

我绝对是使用Joomla的初学者.我正在尝试在另一个模块中加载一个模块,但是找不到如何执行此操作.我一直在尝试添加

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}

用"position"替换了我要加载的模块的位置,但它似乎仅在文章中有效.

with "position" replaced the position of the module I'd like to be loaded but it seems to work only in articles.

我在这里找到了另一个解决方案: http://forum.joomla.org/viewtopic.php?p=1531754&sid=bae9b487983c7e8a9f9c4fbd2958cf52#p1531754 但是我不知道将这段PHP代码放在我的模块中的位置.

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.

感谢您的帮助!

您需要手动添加代码以将内部模块呈现到容器模块.这是一个例子:

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

来自: http://docs.joomla.org/JModuleHelper/renderModule

要显示输出,您需要将代码放在要呈现html的外部模块源部分中.

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.

将"mainmenu"替换为要嵌入的模块名称的位置. (我假设您不想显示标题,所以我删除了第二个参数.)

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