Home

Monday, July 25, 2016

Full Width yii\bootstrap\navbar yii2

Full Width yii\bootstrap\navbar yii2 To make full width of yii\bootstrap\navbar just set the property renderInnerContainer to false as follow

<?php
    NavBar::begin([
        'brandLabel' => 'Aplikasi Sistem Billing Emerald Towers',
        'brandUrl' => Yii::$app->homeUrl,
        'renderInnerContainer'=>false,
        'options' => [
            'class' => 'navbar-default container-fluid',
        ],
    ]);
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        'items' => [
            ['label' => 'Home', 'url' => ['/site/index']],
            ['label' => 'Ganti Password', 'url' => ['/user/changepassword']],        
            Yii::$app->user->isGuest ? (
                ['label' => 'Login', 'url' => ['/site/login']]
            ) : (
                '<li>'
                . Html::beginForm(['/site/logout'], 'post', ['class' => 'navbar-form'])
                . Html::submitButton(
                    'Logout (' . Yii::$app->user->identity->username . ')',
                    ['class' => 'btn btn-link']
                )
                . Html::endForm()
                . '</li>'
            )
        ],
    ]);
    NavBar::end();
    ?>

No comments:

Post a Comment