如何将Joomla组件调用到模块中


How to Call Joomla Component into module?

我使用Joomla网站,我想调用一些控制器+模型+视图的一个组件到模块。这怎么可能。

我寻找代码使用我们创建Jcontroller的对象,然后得到视图的输出到模块,视图使用一些模型为相同的组件

谢谢曼基

//set up any request variables that your component controller may need    
JRequest::setVar('var1','x');
JRequest::setVar('var2','y');
//include your controller and any other files
require_once(JPATH_BASE.'components'.DS.'your_component'.DS.'controllers'.DS.'yourcontroller.php');
//Do you need to tell your component you need module output?
$config = array();
$config['source'] = 'module';
$controller = new yourController($config);
$controller->execute('display');
//Reset any Request vars you have set
JRequest::setVar('var1','');
JRequest::setVar('var2','');