Gii Controller Generator: How to create controller within module?

I am using the Gii Controller Generator.

It says:

admin/user generates admin/UserController.php. If the application has an admin module enabled, it will generate UserController within the module instead.

However, I am not able to get Gii to generate the UserController within the module.

Is there something I need to do to "enable" the module that I created with Gii?


I’m not exactly sure what you mean, but I would definitely go through this tutorial It helped me a lot with the basics.

Well, that link is helpful, for other reasons. What my original question was though, was how to get the Gii Controller thing to generate the controller in the module/ subfodler rather than the global one.

You could always just copy and paste it in there, but that would probably mess some things up. From what I’ve been told, its best to keep all the controllers in one main folder. You can still organize your site hierarchically (e.g. Channel > Shows > Show Information) without having the controllers physically laid out like that.


if i get what u mean.

simply type in the path to where u wish to put ur controller

e.g type in the Gii controller Generator


this code will create a testController in your Admin module(if the Admin module exist). :rolleyes: :rolleyes: :rolleyes: