Answer the question
In order to leave comments, you need to log in
Why is the bootstrap component not showing up in the navbar?
I have the text span class="glyphicon glyphicon-bell"> instead of the icon. Here is the menu code
NavBar::begin([
'brandLabel' => 'Holland',
// 'brandUrl' => Yii::$app->homeUrl,
'brandUrl' => ['/zakaz/index'],
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
// $menuItems = [
// ['label' => 'Home', 'url' => ['/site/index']],
// ['label' => 'About', 'url' => ['/site/about']],
// ['label' => 'Contact', 'url' => ['/site/contact']],
// ];
if (!Yii::$app->user->isGuest) {
$menuItems[] = ['label' => '<span class="glyphicon glyphicon-bell"></span>', 'url' => ['#']];
}
if (Yii::$app->user->isGuest) {
// $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
$menuItems[] = ['label' => 'Войти', 'url' => ['/site/login']];
} else {
$menuItems[] = '<li>'
. Html::beginForm(['/site/logout'], 'post')
. Html::submitButton(
'Выйти (' . Yii::$app->user->identity->username . ')',
['class' => 'btn btn-link logout']
)
. Html::endForm()
. '</li>';
}
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
$menuItems[] = [
'encode' => false,
'label' => '<span class="glyphicon glyphicon-bell"></span>',
'url' => ['#']
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question