Closed quasiperfect closed 8 years ago
Could you give me some details, an example?
sure sorry about that
i want to be able to have a config/routes.php inside the module and be read by the framework
so i can copy one folder that contains the module and that would make the module work the final target is to have every module like a self contained app
I think, you can place route.php within module configuration. Try it, it should work.
Sorry, routes.php
applications/_applicationname/modules/_modulename/config/routes.php
i tried it doesn't work
I tried too, it does not work. I'll have a look.
See this commit: https://github.com/ivantcholakov/starter-public-edition-4/commit/2bffee7ad61b8afcfa320cd68edd13bd07bbca2d
This is an original link: http://iridadesign.com/starter-public-edition-4/www/playground/captcha This is the new link: http://iridadesign.com/starter-public-edition-4/www/playground/kcaptcha
In this regard I stick to the original HMVC implementation - https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/
The feature you asked about is undocumented.
Editi: Sorry, it is documented:
"Each module may contain a config/routes.php file where routing and a default controller can be defined for that module using:
<?php
$route['module_name'] = 'controller_name';
Controllers may be loaded from application/controllers sub-directories. Controllers may also be loaded from module/controllers sub-directories."
I found some information here: http://stackoverflow.com/questions/15640481/codeigniter-with-wiredesignz-hmvc-routing
It looks weird how it works, but maybe there is a reason.
Edit: He omits the module name in the value at the right side, the module name is already known.
PyroCMS uses this feature, here is an example: https://github.com/pyrocms/pyrocms/blob/2.2/develop/system/cms/modules/blog/config/routes.php
As I can see, they stick to the original logic too, only they have added supporting slugs from the database.
thanks so much for your time
i tried and failed
for example lets say we have site (main app) manager (admin) users (module) login_controller i want to call this like so http://domain/manager/login logout_controller i want to call this like so http://domain/manager/logout users_controller i want to call this like so http://domain/manager/users etc would this work ? if so how can i define the routes ?
I don't understand your case.
site (main app) - this is the front-end application? http://domain ? manager (admin) - this is an application too? http://domain/manager ?
users (module) - in which application is this module?
In which application and in which module/modules are these controllers?
I can tell for sure that with module-level route configutation you can not do this:
http://domain/manager/users/login -> http://domain/manager/login
The segment users should be present in the result link, it is how it works.
Otherwise all the routes in all the modules should have been parsed, which is ineffective.
Use local routes.php if you redefine links that as results are inside the same module. Otherwise use the global routes.php.
I suspect, what you want to do is impossible.
This is sample of mnie, I don't use module-level routing definitions so far.
My preference in not making the modules quite big.
Just create separate modules login and logout and you will be fine.
thanks for you input
"I suspect, what you want to do is impossible." i think you are right i will try to organize my modules some other way
TODO: To be examined in the future: https://github.com/Bigwebmaster/codeigniter-modular-extensions-hmvc
I must reopen this issue for not forgetting the research work that is to be done.
The idea in https://github.com/Bigwebmaster/codeigniter-modular-extensions-hmvc sounds complex for adaptation in this starter and I am not sure that I like it. Closing.
hi
how would you go for adding routes / module ?
in my situation every module can have multiple controllers and not always the controller name can be the route
thanks in advance for your response