Routes, how to handle empty strings? [SOLVED, with hack] |
[eluser]xzela[/eluser]
Hi all, I'm trying to use the routing feature in CI and I'm having an issue with handling empty strings with the (:any) flag. Here is what I'm trying to accomplish: When a user goes to the URI http://localhost/pages/cake-types I want to show the user a list of cake types. However, when the user goes to the URI http://localhost/pages/cake-types/cupcakes it should the appropriate page (a page related to cupcakes). The above works (kind of). The issue is when a user goes to http://localhost/pages/cake-types they get a 404 Page Not Found message. Yet, when the user goes to 'child page' like http://localhost/pages/cake-types/cupcakes it works as expected. What is it about my routes file? How do you set it so empty strings are treated correctly? routes.php //routes file Code: $route['pages/cake-types/(:any)'] = 'pages/cake_types/$1'; pages.php //controller file Code: //... Any information you can lend will be much appreciated. Thanks |
Messages In This Thread |
Routes, how to handle empty strings? [SOLVED, with hack] - by El Forum - 07-23-2010, 11:46 AM
Routes, how to handle empty strings? [SOLVED, with hack] - by El Forum - 07-23-2010, 11:59 AM
Routes, how to handle empty strings? [SOLVED, with hack] - by El Forum - 07-23-2010, 12:19 PM
Routes, how to handle empty strings? [SOLVED, with hack] - by El Forum - 07-23-2010, 12:35 PM
Routes, how to handle empty strings? [SOLVED, with hack] - by El Forum - 07-23-2010, 08:14 PM
|