Routes: how to get mycontroller/id function same as mycontroller/action/id |
[eluser]dreamynsx[/eluser]
Hello, I've read routes documentation already, but it really does not have a lot of examples for what I'm trying to do. Please help. Code: // my sample class with index action How do I get it so that both requests like this work: www.site.com/mycontroller/index/3<-- this works by default, sets $id value to 3 www.site.com/mycontroller/3 <-- this fails with 404, since '3' is not valid action www.site.com/mycontroller/add <-- this works as expected www.site.com/mycontroller <-- this will work and load index action by default This is simply because I don't want to use url like www.site.com/cars/index/3 as I think having index at the end of every section looks funny. So www.site.com/cars/3 is what I want to work. Thanks! |
Welcome Guest, Not a member yet? Register Sign In |