之前我在Joomla文章中添加模块的方式是这样的:{loadmodule mod_name}
,但这次我需要向其中传递参数。
如何从文章中向Joomla模块传递参数?
之前我在Joomla文章中添加模块的方式是这样的:{loadmodule mod_name}
,但这次我需要向其中传递参数。
如何从文章中向Joomla模块传递参数?
echo $renderer->render($module, $params);
$param = array('param_name' => 'value'); // param_name = value
$params = array('params' => json_encode($param)); // 'params' (String) should be decoded by the render of the module
echo $renderer->render($module, $params);
步骤8:如何在模块中检索参数
在您的模块帮助程序中,您可以使用$params变量检索参数:
$value = $params->get('param_name');
要了解助手,请阅读本教程:http://docs.joomla.org/J3.3:Creating_a_simple_module/Developing_a_Basic_Module
(本文主要介绍如何创建简单模块并开发基础模块。)我在谷歌上搜索了同样的问题,并找到了你的提问。我知道这已经过时了,但我的发现可能会帮助其他人。现在有一些插件可以嵌入模块并允许您传递参数给它。我的选择是Module Plant。