My issue is that Kohana only renders the view. When I
View::factory('/foo/bar')
in Controller_Other, it doesn't hit Controller_Foo first. I want it to hit the controller, then render the view.
class Controller_Other extends Controller_Template {
public $template = 'main';
public function action_index() {
$this->template->body = View::factory('/foo/bar');
}
}
How would I get it to run through the controller first:
class Controller_Foo extends Controller_Template {
public function action_bar() {
$this->myVar = 'foo';
}
}
so that in the view, $myVar
is always set in views/foo/bar.php
when I call it from some other View::factory()
?
Edit:
there must be a cleaner way than forcing action_bar
to render its own view to string then going:
$foo = new Controller_Foo($this->request, $this->response);
$this->template->body = $foo->action_bar();