Kohana 3 - How do I make the Default Route pass arguments to the Controller's Action?

Posted by John Himmelman on Stack Overflow See other posts from Stack Overflow or by John Himmelman
Published on 2010-05-13T19:20:45Z Indexed on 2010/05/13 19:24 UTC
Read the original article Hit count: 158

Filed under:
|
|

My controller action requires a parameter, but I can't get KO3's router to pass this parameter in the Default route. This sort of thing works with other routes. Here is an example to clarify...

In bootstrap.php...

Route::set('default', '(<controller>(/<action>(/<the_required_param>)))')
 ->defaults(array(
  'controller' => 'DefaultController',
  'action'     => 'index',
  'the_required_param' => 'some_default_value',
 ));

In controller file...

class DefaultController extends Controller
{
    public function index($the_required_param)
    {
        echo 'value: ' . $the_required_param;
    }
}

© Stack Overflow or respective owner

Related posts about php

Related posts about kohana