[英]CodeIgniter: some doubts about HMVC and Views
I've just discovered HMVC Modular Extension for CodeIgniter https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home and it seems perfect for my needs but I have some question. 我刚刚发现了针对CodeIgniter的HMVC模块化扩展https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home ,它看起来非常适合我的需求,但我有一些问题。
Let's say I have two controllers: 假设我有两个控制器:
Now I have these questions: 现在我有这些问题:
If you method is being called via Modules::run() 如果通过Modules :: run()调用方法
There is a third optional parameter lets you change the behavior of the function so that it returns data as a string rather than sending it to your browser.
第三个可选参数允许您更改函数的行为,以便将数据作为字符串返回,而不是将其发送到浏览器。
Eg: 例如:
//put underscore in front to prevent uri access to this method.
public function _module1()
{
$this->load->view('partial_view', array('some data'=>'some data'), TRUE)
}
call it inside your SITE view easily 轻松地在您的SITE视图中调用它
Modules::run('User/_module1')
// should show whatever is in partial_view ie: a form
//an alternative is to pass in any params if the method requires them
Modules::run('User/_module1', $param)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.