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

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

我在这里找到了另一个解决方案:rel="nofollow:http/referr/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天全站免登陆