Routing changes at a single location |
I've recently started using CI and find it really difficult to perform routing changes. Whether I want to specify a form action, or want to redirect to a page, I have to specify some URL fragment, and at a later point, if I decide to make changes to route, I have to find each usage and replace it. How can I avoid doing this?
(10-18-2016, 12:35 PM)RBX Wrote: I've recently started using CI and find it really difficult to perform routing changes. Whether I want to specify a form action, or want to redirect to a page, I have to specify some URL fragment, and at a later point, if I decide to make changes to route, I have to find each usage and replace it. How can I avoid doing this? Did you try (:num) and (:any) regexes ? (10-21-2016, 03:02 AM)d4jk4 Wrote:(10-18-2016, 12:35 PM)RBX Wrote: I've recently started using CI and find it really difficult to perform routing changes. Whether I want to specify a form action, or want to redirect to a page, I have to specify some URL fragment, and at a later point, if I decide to make changes to route, I have to find each usage and replace it. How can I avoid doing this? I use them, but I don't see how they can help in changing rewards/cart/(:num)/add to cart/add/(:num). I've been thinking about 'naming' my routes so I could something like PHP Code: $route[ADD_TO_CART. '(:num)'] = 'controller/action'; Edit: I just read a blog post on CI4 which says named routes are coming. I wish some of these changes could be made to CI3 routes too, at least to turn the magic routing off. |
Welcome Guest, Not a member yet? Register Sign In |