Im using CI-HMVC stock.
Id like to have a module structure like this:
application
modules
userabc
moduleA
controllers
models
views
moduleB
...
userDEF
moduleC
...
Is this an incorrect way of module organization? Is there another common way of doing something like this?
Im wanting to seperate the users module folders and use them in a URL like this:
userABC.domain.com/module/controller/method
userBCD.domain.com/module/controller/method
You can use that structure if you want, but keep in mind the following:
You must define each user’s directory as a module location:
You might be able to do this dynamically, but remember that
config.phpis loaded pretty early so you may need apre_systemhook.The other thing, which is important if you want all users’ modules accessible regardless of which subdomain is active: Order matters!
If userA has a module called “blog” and so does userB, only userA’s will ever get loaded (assuming you define userA’s module path first). If you’re certain no two modules will share the same name, this won’t matter as much, but you may suffer a performance hit as the loader will go through the whole stack of module locations until it finds the requested one.
It sounds like you should define a single
module_locationdepending on what user’s site is loaded (the subdomain). Something like: