Man*_*tel 1 php joomla components module
我正在使用Joomla网站,我想调用一些控制器+模型+将一个组件视图转换为模块.怎么可能.
我正在寻找使用它的代码我们创建Jcontroller的对象,然后将视图输出到模块中,同时View使用了一些模型用于相同的组件
谢谢Manjeet
//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','');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5549 次 |
| 最近记录: |