Commit 17807874 by Qiang Xue

Fixes issue #53: implemented Menu.

parent b703169d
...@@ -23,16 +23,17 @@ $this->registerAssetBundle('app'); ...@@ -23,16 +23,17 @@ $this->registerAssetBundle('app');
<div class="navbar"> <div class="navbar">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<ul class="nav"> <?php $this->widget('yii\widgets\Menu', array(
<li><?php echo Html::a('Home', Yii::$app->homeUrl); ?></li> 'options' => array('class' => 'nav'),
<li><?php echo Html::a('About', array('/site/about')); ?></li> 'items' => array(
<li><?php echo Html::a('Contact', array('/site/contact')); ?></li> array('label' => 'Home', 'url' => array('/site/index')),
<?php if (Yii::$app->user->isGuest): ?> array('label' => 'About', 'url' => array('/site/about')),
<li><?php echo Html::a('Login', array('/site/login')); ?></li> array('label' => 'Contact', 'url' => array('/site/contact')),
<?php else: ?> Yii::$app->user->isGuest ?
<li><?php echo Html::a('Logout (' . Html::encode(Yii::$app->user->identity->username) . ')', array('/site/logout')); ?></li> array('label' => 'Login', 'url' => array('/site/login')) :
<?php endif; ?> array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
</ul> ),
)); ?>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace yii\base; namespace yii\base;
use Yii; use Yii;
use yii\helpers\FileHelper;
use yii\helpers\StringHelper; use yii\helpers\StringHelper;
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment