Very well little grasshopper, here you have something to play:
Following route will take any amount of parameters
(0..n). <id>
represents a number:
Route::set('testparams', 'account(/<params>)/<id>',
array(
'params' => '.+',
'id' => '\d+'))
->defaults(array(
'controller' => 'account',
'action' => 'test',
));
The controller account
and method test
are like this:
class Controller_Account extends Controller {
public function action_test()
{
$params = $this->request->param();
echo Debug::vars($params);
$id = $this->request->param('id');
echo Debug::vars($id);
exit;
}
}
Testing 1:
http://localhost//account/p1/p2/p3/p4/p5/500
// result:
array(2) (
"params" => string(14) "p1/p2/p3/p4/p5"
"id" => string(3) "500"
)
string(3) "500"
Testing 2:
http://localhost/account/500
// result:
array(2) (
"params" => string(0) ""
"id" => string(3) "500"
)
string(3) "500"