Welcome Guest, Not a member yet? Register   Sign In
Routes and RegEx
#1

I've got a question about routes. My controller has an index function that is used for showing a list of items, and some other functions for creating, editing and deleting items.

The url mysite/manage_products triggers the index function.
Now, on the list of items, I've got buttons for multiple categories, let's say: All, New and Used Products.

In my routes.php I have:
PHP Code:
$route['manage_products/all'] = 'manage_products/index/all';
$route['manage_products/new'] = 'manage_products/index/new';
$route['manage_products/used'] = 'manage_products/index/used'

How can I shorten this to one route?
The url manage_products/create should NOT trigger the index function, so I can't have:
PHP Code:
$route['manage_products/(:any)'] = 'manage_products/index/$1'
Reply


Messages In This Thread
Routes and RegEx - by Wouter60 - 09-01-2018, 12:41 AM
RE: Routes and RegEx - by jreklund - 09-01-2018, 01:25 AM
RE: Routes and RegEx - by Wouter60 - 09-01-2018, 08:30 AM
RE: Routes and RegEx - by jreklund - 09-01-2018, 09:25 AM
RE: Routes and RegEx - by Wouter60 - 09-01-2018, 02:29 PM
RE: Routes and RegEx - by jreklund - 09-01-2018, 03:56 PM
RE: Routes and RegEx - by Wouter60 - 09-01-2018, 11:25 PM
RE: Routes and RegEx - by ignitedcms - 09-10-2018, 09:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB