Router still puts param id in url
- vnovotny
- Member | 12
Hi guys, it used to be working in older Nette, but now in 2.0.3 it works strange. The problem is, that router use proper route, but with unexpected result. Example:
Bootstrap.php
$container->router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
$container->router[] = new Route('vina/stat[/kod][/vinarstvi]', array(
'presenter' => 'Vina',
'action' => 'stat',
'kod' => NULL,
'vinarstvi' => NULL
));
$container->router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
latte
<a style="" href="{link Vina:stat kod => $row->KodStatuPuvodu}">TestLink</a>
This produce link in this format: vina/stat?kod=01 , but it should be
vina/stat/01
On top of that, this link always redirects me to vina/stat with both params
NULL.
And if I put in navigation bar vina/stat/01, it redirects me to
vina/stat?id=01
What am I missing? Laděnka always says its used route I wanted…
Sorry quys, I must be really tired, i forgot those <> brackets in route, so it should have been in this format:
$container->router[] = new Route('vina/stat[/<kod>][/<vinarstvi>]', array(
'presenter' => 'Vina',
'action' => 'stat',
'kod' => NULL,
'vinarstvi' => NULL
));
Last edited by vnovotny (2012-04-11 10:28)
- vnovotny
- Member | 12
HosipLan wrote:
How would router know, which one is which?vina/stat[/<kod>][/<vinarstvi>]
, better would bevina/stat[/<kod>[/<vinarstvi>]]
.
This is nice, but what's the difference? I mean, I still can't have <vinarstvi> without <kod> set. Or can I?
And no, those params are not persistant. You can display all items, all items in specific country or all items in specific country and winery.