如何在joomla 2.5中的组件中加载模块

用户名

我在joomla 1.5中使用了一个代码来修饰com_content >>文章中的mod_related_items:

<?php
jimport('joomla.application.module.helper');
$module = &JModuleHelper::getModule('module_type(example:"mod_related_items")','Position-name');
echo JModuleHelper::renderModule($module);
?>

<?php echo $this->item->event->afterDisplayContent; ?>

我曾经在此文件的末尾使用此代码: components/com_content/views/article/tmpl/default.php

现在我想在joomla 2.5中使用此代码。

当我在jooma 2.5中使用它时,出现以下错误:

注意:尝试在第152行上的C:\ wamp \ www \ kknews.ir \ libraries \ joomla \ application \ module \ helper.php中获取非对象的属性

注意:尝试在第156行的C:\ wamp \ www \ kknews.ir \ libraries \ joomla \ application \ module \ helper.php中获取非对象的属性

注意:尝试在第159行的C:\ wamp \ www \ kknews.ir \ libraries \ joomla \ application \ module \ helper.php中获取非对象的属性

注意:第16行的C:\ wamp \ www \ kknews.ir \ templates \ system \ html \ modules.php中未定义的属性:stdClass :: $ content

请帮我。

约宾

试试这个,

         $document = JFactory::getDocument();
         $renderer = $document->loadRenderer('module');

         $Module = JModuleHelper::getModule('mod_fmDataGrid');

         $Params = "param1=bruno\n\rparam2=chris";//If any params
         $Module->params = $Params;//If any params
         echo $renderer->render($Module);

希望它能工作..

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章