阅读下面的论坛帖子,这可能会对您有所帮助
http://forum.joomla.org/viewtopic.php?f=544&t=356176
$modules =& JModuleHelper::getModules('mod_hello');
foreach ($modules as $module)
{
echo JModuleHelper::renderModule($module);
}
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style'=>'raw');
echo $renderer->render('mod_hello',$options,null);
有两种调用 Module 的方法:
在 Content/Article 中调用模块:您可以使用 {loadposition position}(感谢 plgContentLoadModule - /plugins/content/loadmodule.php)
以编程方式调用模块(模块调用另一个模块或组件调用模块):
A. Call Module by position :
$position = 'left';
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod) {
$contents .= $renderer->render($mod, $params);
}
B. Call Module by name :
$modName = 'mostread '; // not mod_mostread
$modTitle = 'Popular';
$mod = JModuleHelper::getModule($modName, $modTitle);
$content = JModuleHelper::renderModule($mod);