Codeigniter HMVC to set up custom routes for modules |
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/codeig...c/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? (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';
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/codeig...gniter-3.x |
Welcome Guest, Not a member yet? Register Sign In |