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

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

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

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

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