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

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
		<div class="container">
			<?= Breadcrumbs::widget([
				'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
			]) ?>
			<?= $content ?>
		</div>
Qiang Xue committed
57
	</div>
Qiang Xue committed
58

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

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