Controller Suffix - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Controller Suffix (/showthread.php?tid=65885) Pages:
1
2
|
RE: Controller Suffix - PaulD - 08-15-2016 Thanks, and you are right, I have never worked in a larger team. I can also see now the benefits of freeing up controllers from url's and having a map of the entire application. Thanks again, Paul. RE: Controller Suffix - spjonez - 08-15-2016 ivantcholakov Wrote:Time ago I have taken a solution from here: http://code.tutsplus.com/tutorials/6-codeigniter-hacks-for-the-masters--net-8308 This method works well we've been using it for a while. My addon Cinder uses it as well. Instead of manually defining all routes you overload the router methods and append '_controller' to the path it uses to load a controller. I haven't updated this repo in a long time but here's an example: https://github.com/monsterlane/codeigniter3-app/blob/master/www/application/core/MY_Router.php You should be able to start with that and update it by comparing your version of CI's system/core/Router.php with the methods defined in that file for any changes other than the suffix stuff. RE: Controller Suffix - albertleao - 08-15-2016 (08-15-2016, 03:00 AM)PaulD Wrote: Thanks, and you are right, I have never worked in a larger team. I can also see now the benefits of freeing up controllers from url's and having a map of the entire application. No problem. One great thing for you to do as practice is build a basic 'blog' or 'todo list' in other languages and/or frameworks. I would focus on frameworks that are highly opinionated. It will give you a perspective of how other people are doing things and how you can maybe implement some of those things into your application. That was the greatest learning experience for myself. RE: Controller Suffix - Ivo Miranda - 08-15-2016 I like magic routing for testing but I don't like the idea of allowing controller direct access. That's why we decided to build an admin module that regenerates routes.php file from what is defined in the database. This way we only allow certain routes and we block the others with 404. I am still not sure if this is the best way but it seems very pratical so far. RE: Controller Suffix - albertleao - 08-15-2016 (08-15-2016, 12:14 PM)Ivo Miranda Wrote: I like magic routing for testing but I don't like the idea of allowing controller direct access. That's an interesting take on it and I see the benefits if you have non-technical people working with you that need to have the ability to shut off endpoints and so on. Unfortunately, until CI4.0 rolls around, users can still access anything not in your routes.php by just figuring out the controller name. |