Welcome Guest, Not a member yet? Register   Sign In
Route to match all but a string
#1

[eluser]cdsuze[/eluser]
Hi guys, I'm new in CI, now re-coding my old fashioned mysql-php-html-together coding style with a MVC framework Smile

So far very good, but I have the following situation:

My site url's are like this

mysite/products
mysite/products/category_nick
mysite/products/category_nick/subcategory_nick

Each of them routes to a different controller/method (I have categories and products controllers). This is so far working good:

$route['^products/(:any)/(:any)/(:any)'] = "products/detail/$1/$2/$3";
$route['^products/(:any)/(:any)'] = "products/list_products/$1/$2";
$route['^products/(:any)'] = "categories/list_subcategories/$1";
$route['^products/?$'] = "categories";

The problem arises when I have a different method inside the products, for instance:

products/upload_image

It fail because it matches my third route, and forwards to categories controller.

I have tried this as a replacement for my third route with no success (I get 404 error):

$route['^products/(?!upload_image)'] = "categories/list_subcategories/$1";

Do you guys can show a better (and working) way to do this job? Is there a way to debug the routing process so I can understand what's the problem?

Thanks a lot in advance,

César Enique


Messages In This Thread
Route to match all but a string - by El Forum - 09-23-2008, 05:33 AM
Route to match all but a string - by El Forum - 09-23-2008, 06:23 AM
Route to match all but a string - by El Forum - 09-23-2008, 05:51 PM
Route to match all but a string - by El Forum - 09-23-2008, 07:44 PM
Route to match all but a string - by El Forum - 09-24-2008, 11:11 AM
Route to match all but a string - by El Forum - 09-24-2008, 11:24 AM
Route to match all but a string - by El Forum - 09-25-2008, 06:09 AM
Route to match all but a string - by El Forum - 09-29-2008, 02:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB