views:

80

answers:

2

I have taken over a Kohana project that needs some modifications. It 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?

+3  A: 

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).

The Pixel Developer
+1  A: 

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 :)

Kemo