main.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\Menu;
  4. use yii\widgets\Breadcrumbs;
  5. use yii\debug\Toolbar;
  6. /**
  7. * @var $this \yii\base\View
  8. * @var $content string
  9. */
  10. $this->registerAssetBundle('app');
  11. ?>
  12. <?php $this->beginPage(); ?>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <meta charset="utf-8"/>
  17. <title><?php echo Html::encode($this->title); ?></title>
  18. <?php $this->head(); ?>
  19. </head>
  20. <body>
  21. <div class="container">
  22. <?php $this->beginBody(); ?>
  23. <div class="masthead">
  24. <h3 class="muted">My Company</h3>
  25. <div class="navbar">
  26. <div class="navbar-inner">
  27. <div class="container">
  28. <?php echo Menu::widget(array(
  29. 'options' => array('class' => 'nav'),
  30. 'items' => array(
  31. array('label' => 'Home', 'url' => array('/site/index')),
  32. array('label' => 'About', 'url' => array('/site/about')),
  33. array('label' => 'Contact', 'url' => array('/site/contact')),
  34. Yii::$app->user->isGuest ?
  35. array('label' => 'Login', 'url' => array('/site/login')) :
  36. array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
  37. ),
  38. )); ?>
  39. </div>
  40. </div>
  41. </div>
  42. <!-- /.navbar -->
  43. </div>
  44. <?php echo Breadcrumbs::widget(array(
  45. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
  46. )); ?>
  47. <?php echo $content; ?>
  48. <hr>
  49. <div class="footer">
  50. <p>&copy; My Company <?php echo date('Y'); ?></p>
  51. <p>
  52. <?php echo Yii::powered(); ?>
  53. Template by <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap</a>
  54. </p>
  55. </div>
  56. <?php $this->endBody(); ?>
  57. </div>
  58. <?php echo Toolbar::widget(); ?>
  59. </body>
  60. </html>
  61. <?php $this->endPage(); ?>