How to changes the Route::set in kohana 3.2

96 Views Asked by At

we have used kohana 3.2. We need to changed the url xyz.com/ar measn the site working arabic lanugag and xyz.com/en means the site working in english language. Now the default 3 param is id. I need to changes this.

  Route::set('custom', '(<controller>(/<action>(/<id>)))')
        ->defaults(array(
            'controller' => 'admin',
            'action'     => 'index',
    ));
    Route::set('live', 'ar/auctions/live')
    ->defaults(array('controller' => 'auctions','action'  => 'closed','method' => NULL));
1

There are 1 best solutions below

0
bato3 On

1 Route::set() have 3 parametrs. Last is Regex patterns for route keys

2 The sequence is important, so first live, second custom

3 Try this:

Route::set('other', '((<lang>)(/)(<controller>(/<action>(/<id>))))', 
                     Array('lang'=>'(en|ar)'))->defaults(array(
    'lang'       => $default_lang,
    'controller' => 'foo',
    'action'     => 'index',
));

I18n::lang(Request::instance()->param('lang'));