Reputation: 628
I use the typical frontend menu from Yii2. Usually the menu items according to the main.php are like
$menuItems[] = [
['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']],
];
In case of pointing to a detail view, this is not working. I cannot use
$menuItems[] = [
['label' => 'Member', 'url' => ['/member/view' . '&id=' . $id]],
also this is not working
$menuItems = [
['label' => 'Member', 'url' => Url::to('member/view', ['id' => $id])],
How can I point from menu items to detail views?
Upvotes: 0
Views: 33
Reputation: 18021
It should be
$menuItems[] = ['label' => 'Member', 'url' => ['/member/view', 'id' => $id]],
Upvotes: 2