H
H
hollanditkzn2017-05-11 15:23:15
Yii
hollanditkzn, 2017-05-11 15:23:15

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();

I still don't understand how to make the icons appear

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-05-11
@hollanditkzn

$menuItems[] = [
    'encode' => false,
    'label' => '<span class="glyphicon glyphicon-bell"></span>', 
    'url' => ['#']
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question