Closed shijialee closed 9 years ago
This is an interesting feature. I can see the desire for it, but I think that desire comes at a price.
This feature's purpose is to make changing URLs easy, without needing to replace code in multiple places. That's always handy, but what happens when you change a URL on a website that is well-established? How will Google know where the new page is? How will your users? I think this makes it easy for people to forget to set up appropriate HTTP redirects and that sort of thing.
Some other things of note:
$route['something/(:num)'] = 'something/number/$1';
$route['something/(:any)'] = 'something/else/$1';
:num
& :any
.Personally, I have never had an issue hardcoding URLs into an application. But I can see how this would be handy. I think it could use some more discussion.
Closing this as duplicate of #218.
New to php and CI... I would hate to hard-code url in my template. a way to reverse mapping the routes from config/routs.php would be really nice.
Looks like there isn't such feature in CI and I found one here http://codefury.net/2010/09/easy-reverse-routing-with-codeigniter/ it is "an extension for the CodeIgniter Router class that I wrote that gives you a nice way to write routes that are reversible and also have the ability to take parameters."
What do you think?