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

45 46 47
	<div class="container">
		<?php echo Breadcrumbs::widget(array(
			'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
48
		)); ?>
49
		<?php echo $content; ?>
Qiang Xue committed
50
	</div>
Qiang Xue committed
51

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

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