tags:

views:

190

answers:

1

How would I construct a hook in Kohana so that ...

http://www.example.com/a_controller/non_existing_method

would route to to the controller title 'a_controller' except call the controller's index method and pass 'non_exisitng_method' as an argument?

It should also allow a fallback, so that if non_existing_method IS a method, it should route to that method.

So, my hook would, in the absence of a matching method, route to the index and provide the rest of the URL as arguments to the index.

How would I do this?

+1  A: 

Implement the __call method in your controller. This is the one called when a non exisitng method in your controller is called. By default it does a 404 but you can specify what you want.

__call() Method

jitter