I had a problem saving the value of a variable after the HMVC subquery in Kohana 3.1.3.1, and I am wondering what is the best way to approach / fix it. I thought that the additional requests in Cohan were isolated from each other, but it seems that this is not so ...
First of all, I created a controller for the Controller_Template extension:
abstract class Controller_Website extends Controller_Template {
public $page_info;
public $allow_caching;
public function before()
{
if ($this->auto_render === TRUE AND $this->request->is_initial())
{
$this->page_info = clone $this->navs[$slug];
}
}
public function after()
{
if (! $this->request->is_initial())
{
$this->response->body($this->template->main_view->render());
}
if ($this->auto_render === TRUE AND $this->request->is_initial())
{
$this->response->body($this->template->render());
}
}
}
And here is an example of what one of the controllers looks like:
class Controller_Events extends Controller_Website {
public function action_filtered()
{
$this->page_info->page_title = 'Set in Events controller';
}
}
Now I want one of my other controllers to be able to output the output from the event controller without a template. Controller_Website (see above) takes care of excluding the template from the output, but think about it:
class Controller_Search extends Controller_Website {
public function action_index()
{
$this->template->main_view->events = Request::factory()
->controller('events')
->action('filtered')
->execute();
$this->page_info->page_title = 'Set in Search controller';
}
}
, echo $this->page_info->page_title; (, , ), , " ", " "
, action_filtered() , , (, , , , ..), . HMVC. / , $page_info, , , , .
, if , , , . ?
, ?
!
DM