V
V
Viktor Yanyshev2017-06-07 08:46:15
Yii
Viktor Yanyshev, 2017-06-07 08:46:15

How is the url of the 2nd level of nesting formed?

Right now in

Menu::widget([
$menu_item = [
['label' => 'Пункт меню', 'url' => 'pages/index']
// И порядка 5 пунктов контроллер/экшен
];
]);

// В config/main.php

'UrlManager' = [
'rule'=>[
'<controller:\w+>' => '<controller>\index'
];
];

At the output I get:
<ul>
<li><a href="/pages/index">Пункт меню</a></li>
<li><a href="/контроллер/index">Пункт меню</a></li>
</ul>

How to always get the url for index actions in the form /pages and not /pages/index? I don't need view urls, I need view urls. I mean that any url of the 2nd level pulls "Controller/index".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dilik Pulatov, 2017-06-07
@villiwalla

just write and you don’t need to specify it in the config, so remove this one ... and it should work the way you want , everything works fine for me

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question