Hi, I’m very new to Yii so forgive me if I’m missing the obvious.
When using modules, you have init() at your disposal, when the module loads.
In init() you have a chance to run some of your code before any of the module controllers/actions get executed.
For instance: In case of a module ‘admin’, you could use this opportunity to always check if a user is logged in or not.
But:
When I’m not using modules, I just have a bunch of controllers.
For instance:
/news runs NewsController->actionIndex
/page runs PageController->actionIndex
Does Yii then still offer an centralized place to run code that always has to be executed, just like init() in a module?
There’s got to be a more efficient way than to place a call to this code in every controller separately?
I’ve got the feeling I’m missing something basic here.
Any pointers?