8.4.2: How to render vew() with variables from other actions in DashboardPageController?
Permalink
I have an item list which I want to filter by either a group or a category or by both a group and a category. The filter actions in a DashboardPageController are:
If I filter the group, I get the group_id in view(). But the problem is when I filter the category and do the view action, it refreshes the page and the group_id value is lost.
In a block controller I can do
But this doesn't work in a page controller.
One way would be to use sessions. Is this the only way? Or is there another way to pass variables to the view in a page controller?
protected $group_id = null; protected $category_id = null; public function view() { \Log::Info($this->group_id); } public function filter_group($id = 0) { if ($id > 0) { $this->group_id = $id; $this->runAction('view'); } else { $this->group_id = null; $this->runAction('view');
Viewing 15 lines of 28 lines. View entire code block.
If I filter the group, I get the group_id in view(). But the problem is when I filter the category and do the view action, it refreshes the page and the group_id value is lost.
In a block controller I can do
$this->view($group_id, $category_id); ... public function view($group_id, $category_id)
But this doesn't work in a page controller.
One way would be to use sessions. Is this the only way? Or is there another way to pass variables to the view in a page controller?