![]() |
Can CodeIgniter auto-generate named routes? - 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: Can CodeIgniter auto-generate named routes? (/showthread.php?tid=88066) |
Can CodeIgniter auto-generate named routes? - AnmamKoodh - 07-13-2023 Is it possible to automatically generate named routes in CodeIgniter when using the $routes->resource() method? For example, can the following named routes be generated: posts for the index page new_post for the new post form show_post for displaying an individual post Is there a way to generate all the necessary named routes automatically? RE: Can CodeIgniter auto-generate named routes? - raicou - 04-12-2024 Hey, my reply is a bit late but your post is why I found this forum in the first place. We are developing a large application and I was researching this, the option to automatically generate routes doesn't exist but I was considering basically writing a helper function and/or extending the router class to automate this. In the end I figured since there won't be THAT many routes anyway and its not like we are constantly adding new ones, that making something like this a reality would be counterproductive. In my case, I ended up manually setting up and naming the routes in an easily memorizable way for me. Of course maybe your application is different, and if you did end up making all the needed modifications I would be really keen on seeing how you implemented it in the end! |