I created a module called administration and I wanted to use a layout in administration/views/layouts called main. The DefaultController insisted on using the application layout, I noticed when I searched the forums a few other people had the same problem and used a work around where they set the layout in the controller and not in the module as is recommended in the documentation.
The documentation recommends setting module::layout and module::layoutPath and as CController defaults to a NULL layout it will use the module layout.
What I missed however is that the DefaultController generated by gii during module generation actually extends Controller not CCcontroller and if you generated your app from the CLI tool then the layout for Controller defaults to:
Hope this saves someone from the stupid mistake I made.
My sollution was to have DefaultController extend CController and do:
Sorry to jump on an old thread, and it’s really good advice, but I’d like to add one thing, in case anyuone’s in the situation I’m in where I need a method located in the Controller class. Instead of extending the default controller from CController, you can still extend from Controller (as that extends from CController anyway), only you’ll need to remove the following line from the Controller class;
as this is overwriting the value set in the init() method for the module controller