Codeigniter HMVC to set up custom routes for modules - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Codeigniter HMVC to set up custom routes for modules (/showthread.php?tid=1661) |
Codeigniter HMVC to set up custom routes for modules - mdixon18 - 03-30-2015 I am working quite closely with Codeigniter the PHP framework. Now I've added this Modular Extensions - HMVC to my Codeigniter framework. https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/overview Now, I've created my own module in the modules folder and set up directories for controllers, models and views as instructed. However I'm struggling specifically with custom routing. I have created the config directory in my module blog directory and I have created the routes.php file within. Now to access my module in the browser i would go to localhost:8888/blog/ now I'm mostly asking out of curiosity, I wanted to create a custom route so that maybe I could access the page like localhost:8888/posts/ so I thought that setting up the following route would work: Code: $route['posts'] = 'blog'; Code: $route['posts/listings'] = 'blog/listings'; Is it possible to create custom routes like this in a module? RE: Codeigniter HMVC to set up custom routes for modules - laynebay - 03-30-2015 (03-30-2015, 07:40 PM)mdixon18 Wrote: Is it possible to create custom routes like this in a module? It is possible - I've done it a few times before and works as expected. Not sure if you're using CI2 or CI3, I've only used this feature with CI2 so far. Quick example of routes in ...modules/cn-pto/config/routes.php Code: $route['cn-pto'] = 'cn_pto'; RE: Codeigniter HMVC to set up custom routes for modules - mdixon18 - 03-31-2015 Works a treat with CI2, just struggling with CI3 RE: Codeigniter HMVC to set up custom routes for modules - mwhitney - 04-01-2015 Did you make sure to download Wiredesignz HMVC from the codeigniter-3.x branch? The original version (default branch) won't work with CI3. https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/branch/codeigniter-3.x |