Main.php

Hey

how to use controller or models function in config/main.php

I need to dynamically loaded module array in config/main.php

Hi Amir Sabet,

config/main.php is not supposed to have dynamic contents. It is rather a set of application wide static declarations before you call a certain set of controller, models and views.

As for modules, you can simply declare all the possible modules that you may need in your config/main.php. Those declarations are just the hints for Yii’s auto loading mechanism. They don’t require much memory and CPU time.

I strongly recommend reading the relevant section of the official guide. Its right on spot the subject you’re interested in.