We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

phalcon - before executing view event?

I want to execute:

$this->view->setVar("menus",$menus);

before the view gets executed.

$menus is an array that can be added in different controllers.

Finally before executing the view i want to put the menus var in the view.

function afterExecuteRoute() does not do the job



8.7k

I'd put it in the BaseController that's extended by all other controllers.



2.0k
edited Jun '14

Or u can use the view beforeRender event.