Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Nested Modules?
#1

[eluser]JasonS[/eluser]
I have asked in the modular extensions thread but haven't had much luck.

I am trying to nest a module within a module.

I want to have the following..

modules
- admin
--- users
--- pages
--- etc

I thought the documentation said that modules can be nested but I cannot work out how to do it and after speaking with a couple of people it would appear it isn't possible. As a result does anyone know how I can achieve this?

Is there a way to achieve the above either with the routes config file or by dynamic routing in the admin controller.

For example, when I call admin/users, the admin module controller is fired. Is there some way to add some code in the construct function to reroute to whatever nested module is called?

If none of the above is possible or easily achieved could someone tell me how I can create a second modules folder?

This way in my application I would have

/modules
-- modules here
/admin
-- admin modules here

Logistically this might actually be better.

To add a final layer of complexity, is it possible to delete the controller/model folder from my application directory? The views folder is handy for default view files like header files but I have no use for the default controller/model folders as everything is in modules.

Thanks for taking the time to read my questions.
#2

[eluser]dcunited08[/eluser]
I believe the latest release of ME allows for nested folders within modules folder for views and models but not controllers i.e.

modules/
-Media/
--Books/
---views/
---models/
--Videos/
---views/
---models/
--views/
--models/
--controllers/

I, myself am rather confused as to why that is. I seem to remember in the prior version that I was able to load the controllers from submodules as well. The problem with moving module folders up a level is that you are putting them on the same plane as application folders (config/ helpers/ libraries/) and can add confusion that they are indeed modules. Actually doing that should not be too hard, configure MODDIR to be the same as APPPATH. You may delete those folders and CI should not throw a major fit about it with ME but the more you mess with removing directories such as those staples and moving modules out of their folder, the more you loose the MVC design characteristics that are helpful within CI, this is completely opinion though.




Theme © iAndrew 2016 - Forum software by © MyBB