routes - CakePHP 1.3 Routing problem -
it can't correct route following:
router::connect('/ctl/act/subact/:mode/:sort' , array('controller' => 'ctl', 'action' => 'act_subact', 'mode' => null , 'sort' => null));
--
$html->link('go',array('controller'=>'ctl','action'=>'act_subact'))
--
<a href="/ctl/act_subact/">go</a>
how can do? env:cakephp 1.3.6 php5.2.5 on apache2
the route /ctl/act/subact/:mode/:sort
means there must :mode
, :sort
parameter. route not match url /ctl/act/subact/
. if there optional parameters, need denote asterisk: /ctl/act/subact/*
. route match urls /ctl/act/subact/
, /ctl/act/subact/foo
, /ctl/act/subact/foo/bar
.
if need these optional parameters named parameters, you'll need create several routes each possible "length":
router::connect('/ctl/act/subact/:mode/:sort', array('controller' => 'ctl', 'action' => 'act_subact', 'mode' => null, 'sort' => null)); router::connect('/ctl/act/subact/:mode', array('controller' => 'ctl', 'action' => 'act_subact', 'mode' => null)); router::connect('/ctl/act/subact/', array('controller' => 'ctl', 'action' => 'act_subact'));
Comments
Post a Comment