have certain controllers in a subdir

ok, now that I fixed some terrible mistakes in my app

I’m trying to “create” an admin section, that is nothing but an admin path added at the beginning of certain controllers.

more or less I’ve managed to create the correct entries using rules in config/main.php but now I’ve got two problems:

  1. the default action (i.e. “list”) in the controller isn’t used when accessing admin/myController, so I don’t know if I should handle a redirect in the adminController itself or there’s a cleaner way to do that in the path rules.

  2. I don’t know if there’s a way to disable old control paths: if now I have admin/myController, myController shouldn’t be available anymore. How to do that?

Thank you very much for your help.

Are you talking about something that is expected to work like a module?

a component you mean?

the admin section is driven actually as a controller, it doesn’t have to be a module, since it’s not representing data it its proper terms.

aren’t you confusing modules with models?

ops. sorry I misread it.

so the answer is “yes”, it’s like a module.

but some of the models used by the admin area are actually used by other controllers, so it’s hard to say that’s a module in its proper terms (something “separate”).

the only thing I want to do is:

I have some models with their own controllers and views

I need a controller (adminController class) that can let the user access some of those controllers’ functionality (a sort of controller of controllers) through the views already built.

As they are now, most of the functionality is in place, but probably not meant as I used it. This means that I first created all the models-controllers-views and then found I needed an admin area (as it’s meant to be).

That means that now the original controllers can be directly accessed, obviously, and some of their own functionality is disrupted (like the default action).

I probably just solved the problem in a quick and easy way (very hacky probably) but I’d like to use it in a proper yii-way (if there’s one).

hope I’ve explained it well.

Check out if these links can be of any help