Using nested modules


Can anyone tell me if I can use a module as module but in the same time as submodule of a module?

Ex: Let’s say I have a site with 2 modules: admin and news.

  1. Using as module for frontend: /index.php?r=news => display the news with front-end layout

  2. Using as submodule for backend operations: /index.php?r=admin/news => display the news with back-end layout (for editing and stuff).

The main reason is to keep all logic about backend and frontend of the module news is one place.

How can i generate the CRUD inside the module with the gii ?


If you don’t really want two modules, why not just change URLs?

yes, you can

i’ve also created a modified version of gii module creator to support nested modules and can be found here

to set it up do the following:








to create crud inside just define the controller name like : ‘admin/news/myController’


Because depending how the module is accessed i can filter some operation: if is accessed as submodule it means someone accessed the backend area and allow user to edit the article, othewise i don’t allow him.

The ideea is to have a single compact module news, and in the same time to create different url for backend and frontend area.