Kohana – Tips on Setting up Routes

Kohana – Tips on Setting up Routes

Always set the default Route the last one, else specific Route will be overwritten

Set specific Route for a particular task

// specific Route for a particular task 
Route::set('doSomething', 'doSomething(/<controller>(/<action>(/<id>)))')
    ->defaults(
		array(
			'directory'  => 'doSomething',
			'controller' => 'page',
			'action'     => 'index',
		)
	);
	
// set default at the last position, else other routes will not work
Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(
		array(
			'directory'  => '',
			'controller' => 'page',
			'action'     => 'index',
		)
	);

Leave a Reply

Your email address will not be published. Required fields are marked *

7 + 17 =