【发布时间】:2011-08-11 21:37:09
【问题描述】:
我正在使用 Joomla 站点,我想将一个组件的一些控制器+模型+视图调用到模块中。这怎么可能。
我正在寻找代码来使用我们创建 Jcontroller 的对象,然后将视图的输出输入到模块中,View 也为同一组件使用了一些模型
谢谢 曼吉特
【问题讨论】:
标签: php module joomla components
我正在使用 Joomla 站点,我想将一个组件的一些控制器+模型+视图调用到模块中。这怎么可能。
我正在寻找代码来使用我们创建 Jcontroller 的对象,然后将视图的输出输入到模块中,View 也为同一组件使用了一些模型
谢谢 曼吉特
【问题讨论】:
标签: php module joomla components
//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','');
【讨论】: