Welcome Guest, Not a member yet? Register   Sign In
URI like controller/var/controller/var ?
#1

[eluser]Unknown[/eluser]
my system:

models:
category
brand
vehicle

controllers:
home
brand
category
vehicle
etc.

DB:

brand
id | name
category
id | name (enum car, truck, bike etc)
vehicle
id | model | id_brand | id_category

In the 'home' controller, the 'index' method list all brands. There is a link on each brand to 'brand/view/name'

The method 'view' of 'brand' controller shows brand's name and a list like this:

CAR | TRUCK | ANOTHERCATEGORY
total: 55 | total: 21 | total: 0

In a system like this, which is the best way to link each of these itens of the list to the 'vehicle' controller?
In regular php i would do like this:
vehicle.php?id_brand=x&id_category=y

I made it work like this on CI:
$route['brand/category/(:any)']='category/view/$1';
brand/category/honda/car

that's ok, but would be more intuitive if i could make URI look like:
brand/honda/category/car

and for vehicle controller:
brand/honda/category/car/vehicle/civic

i think i can create one controller(and turn it my default controller) and make a method for remap this URI, but is there any better option?

ps: sorry for bad english, its not my native language.


Messages In This Thread
URI like controller/var/controller/var ? - by El Forum - 08-06-2014, 05:20 PM
URI like controller/var/controller/var ? - by El Forum - 08-06-2014, 06:14 PM
URI like controller/var/controller/var ? - by El Forum - 08-07-2014, 12:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB