main.php 1.57 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 19
	<meta charset="<?= Yii::$app->charset ?>"/>
	<title><?= Html::encode($this->title) ?></title>
20
	<?php $this->head() ?>
Qiang Xue committed
21 22
</head>
<body>
23
<?php $this->beginBody() ?>
24
	<?php
25
		NavBar::begin([
26 27
			'brandLabel' => 'My Company',
			'brandUrl' => Yii::$app->homeUrl,
28
			'options' => [
29
				'class' => 'navbar-inverse navbar-fixed-top',
30 31 32
			],
		]);
		echo Nav::widget([
Qiang Xue committed
33
			'options' => ['class' => 'navbar-nav navbar-right'],
34 35 36 37
			'items' => [
				['label' => 'Home', 'url' => ['/site/index']],
				['label' => 'About', 'url' => ['/site/about']],
				['label' => 'Contact', 'url' => ['/site/contact']],
38
				Yii::$app->user->isGuest ?
39
					['label' => 'Login', 'url' => ['/site/login']] :
40
					['label' => 'Logout (' . Yii::$app->user->identity->username . ')' ,
41 42 43 44
						'url' => ['/site/logout'],
						'linkOptions' => ['data-method' => 'post']],
			],
		]);
45 46
		NavBar::end();
	?>
Qiang Xue committed
47

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

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

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