N
N
neochar2016-07-12 10:57:11
Yii
neochar, 2016-07-12 10:57:11

How to pass GET parameter to url in Yii2 in Widget Nav?

Just started learning Yii. I work with the Nav widget following the example from the interactive course by Evgeny Tkachenko . I pass the url parameter to the Nav (/site/about for example). Things are good.
The lesson "Views and Templates" suggests using yii\web\ViewAction, which allows displaying simple pages without separate ones actionin the controller, but simply /site/page&view=aboutdisplaying the contents of the /fronted/views/site/pages/about.php.
How to pass this link as urlto Nav::widget?
Example:

$menuItems = [
    ['label' => 'Главная', 'url' => ['/site/index']],
    ['label' => 'О нас', 'url' => ['/site/page&view=about'], 'encode' => 'false'],
];
echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
    'items' => $menuItems,
]);

/site/page&view=about- escaped when displaying the widget.
Is there a way to bypass this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SharuPoNemnogu, 2016-07-12
@neochar

['/site/page', 'view' => 'about']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question