main.php 1.64 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

Qiang Xue committed
8
/**
9 10
 * @var \yii\web\View $this
 * @var string $content
Qiang Xue committed
11
 */
12
AppAsset::register($this);
Qiang Xue committed
13
?>
14
<?php $this->beginPage() ?>
Qiang Xue committed
15
<!DOCTYPE html>
16
<html lang="<?= Yii::$app->language ?>">
Qiang Xue committed
17
<head>
Alexander Makarov committed
18
	<meta charset="<?= Yii::$app->charset ?>"/>
19
	<meta name="viewport" content="width=device-width, initial-scale=1">
Alexander Makarov committed
20
	<title><?= Html::encode($this->title) ?></title>
21
	<?php $this->head() ?>
Qiang Xue committed
22 23
</head>
<body>
24
<?php $this->beginBody() ?>
25
	<?php
26
		NavBar::begin([
27 28
			'brandLabel' => 'My Company',
			'brandUrl' => Yii::$app->homeUrl,
29
			'options' => [
30
				'class' => 'navbar-inverse navbar-fixed-top',
31 32 33
			],
		]);
		echo Nav::widget([
Qiang Xue committed
34
			'options' => ['class' => 'navbar-nav navbar-right'],
35 36 37 38
			'items' => [
				['label' => 'Home', 'url' => ['/site/index']],
				['label' => 'About', 'url' => ['/site/about']],
				['label' => 'Contact', 'url' => ['/site/contact']],
39
				Yii::$app->user->isGuest ?
40
					['label' => 'Login', 'url' => ['/site/login']] :
41
					['label' => 'Logout (' . Yii::$app->user->identity->username . ')' ,
42 43 44 45
						'url' => ['/site/logout'],
						'linkOptions' => ['data-method' => 'post']],
			],
		]);
46 47
		NavBar::end();
	?>
Qiang Xue committed
48

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

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

63
<?php $this->endBody() ?>
Qiang Xue committed
64 65
</body>
</html>
66
<?php $this->endPage() ?>