main.php 2.12 KB
Newer Older
Qiang Xue committed
1
<?php
2
use yii\helpers\Html;
3 4
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
5
use yii\widgets\Breadcrumbs;
6
use app\assets\AppAsset;
7

8 9 10
/* @var $this \yii\web\View */
/* @var $content string */

11
AppAsset::register($this);
Qiang Xue committed
12
?>
13
<?php $this->beginPage() ?>
Qiang Xue committed
14
<!DOCTYPE html>
15
<html lang="<?= Yii::$app->language ?>">
Qiang Xue committed
16
<head>
17 18
    <meta charset="<?= Yii::$app->charset ?>"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
19
    <?= Html::csrfMetaTags() ?>
20 21
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
Qiang Xue committed
22 23
</head>
<body>
24

25
<?php $this->beginBody() ?>
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    <div class="wrap">
        <?php
            NavBar::begin([
                'brandLabel' => 'My Company',
                'brandUrl' => Yii::$app->homeUrl,
                'options' => [
                    'class' => 'navbar-inverse navbar-fixed-top',
                ],
            ]);
            echo Nav::widget([
                'options' => ['class' => 'navbar-nav navbar-right'],
                'items' => [
                    ['label' => 'Home', 'url' => ['/site/index']],
                    ['label' => 'About', 'url' => ['/site/about']],
                    ['label' => 'Contact', 'url' => ['/site/contact']],
                    Yii::$app->user->isGuest ?
                        ['label' => 'Login', 'url' => ['/site/login']] :
                        ['label' => 'Logout (' . Yii::$app->user->identity->username . ')',
                            'url' => ['/site/logout'],
                            'linkOptions' => ['data-method' => 'post']],
                ],
            ]);
            NavBar::end();
        ?>
Qiang Xue committed
50

51 52 53 54 55 56 57
        <div class="container">
            <?= Breadcrumbs::widget([
                'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
            ]) ?>
            <?= $content ?>
        </div>
    </div>
Qiang Xue committed
58

59 60 61 62 63 64
    <footer class="footer">
        <div class="container">
            <p class="pull-left">&copy; My Company <?= date('Y') ?></p>
            <p class="pull-right"><?= Yii::powered() ?></p>
        </div>
    </footer>
Qiang Xue committed
65

66
<?php $this->endBody() ?>
Qiang Xue committed
67 68
</body>
</html>
69
<?php $this->endPage() ?>