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

Pass data to views that use same layout

Hello. I was wondering what could be a good solution to pass data to views that use same layout? For instance let's say That I have HomeController and SigninController and they both have the same layout. Would it be an overkill if I would create a BaseController for those controllers that use the same layout and for the controllers that use different layout - another base controller? Or it is better to do it within an initiliazile function of each of the controllers ? Or maybe another solution would be cleaner ? Thanks in advance


What kind of data? How many controllers need to access the data? Could you store it in the session?


I totally forgot that it could be done with session. Thanx :) My bad. A silly question

No such thing as a silly question :) Glad to help!