开发者

kohana routing not working properly

开发者 https://www.devze.com 2023-04-12 08:53 出处:网络
I run 开发者_JAVA百科with this default routing: Route::set(\'default\', \'(<controller>(/<action>(/<id>)))\')

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号