Fuelphp - pass default parameter to a controller in a rewrote route

896 views Asked by At

I want to do something I thought was pretty basic using fuelphp Basically I need to use multiple urls with only one controller, and assign each different route a default parameter (a cat id for that matter)

For instance in my Listing controller I want to use 2 different routes :

/bags
/accessories

to each of which would be assigned it's cat id

Can't seem to find any easy way to do it in fuelphp...

1

There are 1 answers

7
Emlyn On BEST ANSWER

You can specify a route like 'path/here/(:segment) => 'controller/cat/$1 which will then pass the segment captured in the route as the first parameter to a method called action_cat in the controller class.

This behaviour is pretty well outlined in the documentation http://fuelphp.com/docs/general/routing.html