Answer the question
In order to leave comments, you need to log in
How to mark active link in yii2?
How can I add a class to the active link?
<div class="sidebar__nav-list">
<a href="<?= URL::toRoute('dashboard/dashboard') ?>" class="sidebar__nav-item">
<img src="/admin/images/sidebar/dashboard.png" class="sidebar__icon-item">
</a>
<a href="<?= URL::toRoute('info/info') ?>" class="sidebar__nav-item">
<img src="/admin/images/sidebar/info.png" class="sidebar__icon-item">
</a>
<a href="<?= URL::toRoute('news/news') ?>" class="sidebar__nav-item">
<img src="/admin/images/sidebar/news.png" class="sidebar__icon-item">
</a>
</div>
Answer the question
In order to leave comments, you need to log in
Everything is mixed up.. horses, people...
Class Do you mean CSS class? What do you mean by active class? You can assign any template to any action and pass any data to it, on the basis of which you can implement the substitution of the CSS class in the desired item.
I understand - your task is to make a menu with active elements ??
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question