kohana routing not working properly
I run 开发者_JAVA百科with this default routing:
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
Now i have set up user/index and user/login, by:
Class Controller_User extends Controller {
public function action_index()
{
#stuff
}
public function action_login(){
# stuff
}
Now i have another controller right now called class Controller_Restaurants. I can access this by restaurants/index, restaurants/view . I would like to access this as: user/restaurants/index, user/restaurants/view
I have this at the moment:
Class Controller_Restaurants extends Controller{
I tried with this:
Class Controller_User_Restaurans extends Controller{
But it does not work.. What have i missed?
Route::set('restaurants', 'user/restaurants(/<action>)')
->defaults(array(
'controller' => 'restaurants',
'action' => 'index',
));
I'd advise against using the default route, and build better, more meaningful specific routes.
精彩评论