Answer the question
In order to leave comments, you need to log in
How to make menu item selected in yii2?
How to make menu items selected on your page
If in "About Us" so that there is li class="" there is li class="selected"
in main.php such menu code
<div class="menu-container clearfix vertical-align-cell">
<nav>
<ul class="sf-menu">
<li class="selected">
<a href="<?=Url::toRoute('/site/index')?>" title="Главная">
ГЛАВНАЯ
</a>
</li>
<li>
<a href="<?=Url::toRoute('/site/about')?>" title="О НАС">
О НАС
</a>
</li>
<li>
<a href="<?=Url::toRoute('/site/uslugi')?>" title="УСЛУГИ">
УСЛУГИ
</a>
</li>
Answer the question
In order to leave comments, you need to log in
<li class="<?=(Yii::$app->controller->id == 'site' ? 'selected' : '')?>">
<a href="<?=Url::toRoute('/site/about')?>" title="О НАС">
О НАС
</a>
</li>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question