Is there something in Kohana similar to CakePHP's requestAction?
I have taken over a Kohana project that needs some modifications. I开发者_StackOverflow中文版t doesn't really seem to follow the conventional MVC patterns (at least what I've learned from CakePHP). I need to do some dirty hacks to get data from a controller within a view which I would use $this->requestAction(...) in CakePHP.
My question is, is there anything similar in Kohana that will return the results of a controller's action?
Take a look at the Kohana guide Views and HTML. If that's not what you're looking for then ...
You can also do sub-requests in Kohana 3 using it's HMVC features.
$response = Request::factory('URL')->execute()->response;
That internally calls the URL and returns the output (as it normally would in the browser).
Within a controller :
$this->request->response = View::factory('some_view_file')
->set(array(
'some_var' => $some_value,
'other_var' => $other_value,
));
Than, in the some_view_file, you can call it with $some_var
. Everything must be passed to a view file, it should never contain any application logic.
If you still don't get it, you should ask yourself do you really understand php5 oop & (h)mvc pattern :)
精彩评论