Answer the question
In order to leave comments, you need to log in
How to add counter to nav?
I need to set the number of new notifications in navbar. I have an empty counter with this approach. or as I understand it is necessary to drive into a variable and then display everything or not?
<?php
NavBar::begin([
'brandLabel' => 'Holland',
'brandUrl' => ['/zakaz/index'],
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
if (!Yii::$app->user->isGuest) {
$menuItems[] = ['encode' => false, 'label' => '<span class="glyphicon glyphicon-bell" style="font-size:21px"></span><span class="badge">.$count'.$count, 'options' => ['id' => 'notification']];
}
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
]);
NavBar::end();
?>
Answer the question
In order to leave comments, you need to log in
or as I understand it is necessary to drive into a variable and then display everything or not?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question