Answer the question
In order to leave comments, you need to log in
How to link to homepage in navbar in yii2?
$menuItems = [
['label' => 'Сайт', 'url' => ['/@frontend/web/site/index']], <--- Как перейти из backend во фронтенд ?
['label' => 'Статичные страницы', 'url' => ['/staticpages/index']],
['label' => 'Лента' , 'url' => ['alaniatape/index']],
['label' => 'Картинки', 'url' => ['img/index']],
];
Answer the question
In order to leave comments, you need to log in
I'm not sure that you need to specify Web after the frontend
alias
. You can also go to the main one in this way
. In general, you can do it in the same way for the backend.
Toaster
['label' => 'Главная', 'url' => '/'],
depending on the settings of the url manager, it may work like this:
where site is the name of the controller, and index is the action of the main page
There are several ways to get to the right place for sure:
Effective:
find out the data on a specific page:
<?= __FILE__; // абсолютный путь ?>
<?=$this->context->module->id; // какой модуль используется ?>
<?=Yii::$app->controller->action->id; // имя экшена ?>
<?=Html::a('Главная', Url::toRoute('/web/page/index'));?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question