|
11 | 11 | use yii\bootstrap5\NavBar; |
12 | 12 |
|
13 | 13 | AppAsset::register($this); |
| 14 | + |
| 15 | +$this->registerCsrfMetaTags(); |
| 16 | +$this->registerMetaTag(['charset' => Yii::$app->charset], 'charset'); |
| 17 | +$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']); |
| 18 | +$this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']); |
| 19 | +$this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']); |
| 20 | +$this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => '@web/favicon.ico']); |
14 | 21 | ?> |
15 | 22 | <?php $this->beginPage() ?> |
16 | 23 | <!DOCTYPE html> |
17 | 24 | <html lang="<?= Yii::$app->language ?>" class="h-100"> |
18 | 25 | <head> |
19 | | - <meta charset="<?= Yii::$app->charset ?>"> |
20 | | - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
21 | | - <?php $this->registerCsrfMetaTags() ?> |
22 | 26 | <title><?= Html::encode($this->title) ?></title> |
23 | 27 | <?php $this->head() ?> |
24 | 28 | </head> |
25 | 29 | <body class="d-flex flex-column h-100"> |
26 | 30 | <?php $this->beginBody() ?> |
27 | 31 |
|
28 | | -<header> |
| 32 | +<header id="header"> |
29 | 33 | <?php |
30 | 34 | NavBar::begin([ |
31 | 35 | 'brandLabel' => Yii::$app->name, |
32 | 36 | 'brandUrl' => Yii::$app->homeUrl, |
33 | | - 'options' => [ |
34 | | - 'class' => 'navbar navbar-expand-md navbar-dark bg-dark fixed-top', |
35 | | - ], |
| 37 | + 'options' => ['class' => 'navbar-expand-md navbar-dark bg-dark fixed-top'] |
36 | 38 | ]); |
37 | 39 | echo Nav::widget([ |
38 | 40 | 'options' => ['class' => 'navbar-nav'], |
39 | 41 | 'items' => [ |
40 | 42 | ['label' => 'Home', 'url' => ['/site/index']], |
41 | 43 | ['label' => 'About', 'url' => ['/site/about']], |
42 | 44 | ['label' => 'Contact', 'url' => ['/site/contact']], |
43 | | - Yii::$app->user->isGuest ? ( |
44 | | - ['label' => 'Login', 'url' => ['/site/login']] |
45 | | - ) : ( |
46 | | - '<li>' |
47 | | - . Html::beginForm(['/site/logout'], 'post', ['class' => 'form-inline']) |
48 | | - . Html::submitButton( |
49 | | - 'Logout (' . Yii::$app->user->identity->username . ')', |
50 | | - ['class' => 'btn btn-link logout'] |
51 | | - ) |
52 | | - . Html::endForm() |
53 | | - . '</li>' |
54 | | - ) |
55 | | - ], |
| 45 | + Yii::$app->user->isGuest |
| 46 | + ? ['label' => 'Login', 'url' => ['/site/login']] |
| 47 | + : '<li class="nav-item">' |
| 48 | + . Html::beginForm(['/site/logout']) |
| 49 | + . Html::submitButton( |
| 50 | + 'Logout (' . Yii::$app->user->identity->username . ')', |
| 51 | + ['class' => 'nav-link btn btn-link logout'] |
| 52 | + ) |
| 53 | + . Html::endForm() |
| 54 | + . '</li>' |
| 55 | + ] |
56 | 56 | ]); |
57 | 57 | NavBar::end(); |
58 | 58 | ?> |
59 | 59 | </header> |
60 | 60 |
|
61 | | -<main role="main" class="flex-shrink-0"> |
| 61 | +<main id="main" class="flex-shrink-0" role="main"> |
62 | 62 | <div class="container"> |
63 | | - <?= Breadcrumbs::widget([ |
64 | | - 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], |
65 | | - ]) ?> |
| 63 | + <?php if (!empty($this->params['breadcrumbs'])): ?> |
| 64 | + <?= Breadcrumbs::widget(['links' => $this->params['breadcrumbs']]) ?> |
| 65 | + <?php endif ?> |
66 | 66 | <?= Alert::widget() ?> |
67 | 67 | <?= $content ?> |
68 | 68 | </div> |
69 | 69 | </main> |
70 | 70 |
|
71 | | -<footer class="footer mt-auto py-3 text-muted"> |
| 71 | +<footer id="footer" class="mt-auto py-3 bg-light"> |
72 | 72 | <div class="container"> |
73 | | - <p class="float-left">© My Company <?= date('Y') ?></p> |
74 | | - <p class="float-right"><?= Yii::powered() ?></p> |
| 73 | + <div class="row text-muted"> |
| 74 | + <div class="col-md-6 text-center text-md-start">© My Company <?= date('Y') ?></div> |
| 75 | + <div class="col-md-6 text-center text-md-end"><?= Yii::powered() ?></div> |
| 76 | + </div> |
75 | 77 | </div> |
76 | 78 | </footer> |
77 | 79 |
|
|
0 commit comments