繁体   English   中英

在Joomla中使用JModuleHelper :: getModule加载自定义html模块

[英]Load custom html module with JModuleHelper::getModule in Joomla

我正在使用以下代码渲染joomla! 模块:

        jimport('joomla.application.module.helper');
        $module = JModuleHelper::getModule('AddToCartReplacementBtn');
        echo JModuleHelper::renderModule($module);

但是在我的特定情况下它似乎不起作用

我正在加载名为AddToCartReplacementBtn的自定义HTML模块。 它的位置也是AddToCartReplacementBtn

该文档说,我可以按模块的真实名称或文件夹加载模块。

还有其他方法可以按其真实名称加载模块吗?

$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$module = JModuleHelper::getModule('mod_custom','AddToCartReplacementBtn');
echo $renderer->render($module);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM