在Joomla中的另一个模块中加载一个模块 [英] Loading a module in another module in Joomla

查看:174
本文介绍了在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).

这篇关于在Joomla中的另一个模块中加载一个模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆