I have hmvc setup and working fine,
I have a gallery module.
The gallery module breaks down into three controllers and it's structure is as follows:
/modules/gallery/
/modules/gallery/config/
/modules/gallery/helpers/
/modules/gallery/controllers/
/modules/gallery/controllers/gallery.php
/modules/gallery/controllers/galleries.php
/modules/gallery/controllers/images.php
/modules/gallery/models/
/modules/gallery/models/galleriesmodel.php
/modules/gallery/models/imagesmodel.php
/modules/gallery/views/dashboard.tpl
/modules/gallery/views/galleries/dashboard.tpl
/modules/gallery/views/images/dashboard.tpl
anyway, I have a function inside my images.php
controller called list_items
So I want to map the url
http://example.com/gallery/images/list to
http://example.com/gallery/images/list_items
So I thought, sweet as,
I will just add a /modules/gallery/config/routes.php
with the route inside it.
But it seems the routes are not being included.
The routes from /application/config/routes.php
are included and if I put a die('loaded')
in the module routes.php
the it does kill the script,
But running
print_r($this->router)
from one of the controllers does not show up any of the routes from the module routes.php
.
What's going on here?
As far as I know,
HMVC only looks for requested controllers inside each module, with different hierarchy models, but route overrides using routes.php within modules are never read.
Look into MX_Router::locate
it never looks for routes.php
inside any module.
Also it does not override CI_Router::_set_routing
which looks for routes.php
in config folder.
You will have to override CI_Router::_set_routing
and read config/router.php
in every available module for your module route overrides to work.