main.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\Menu;
  4. use yii\widgets\Breadcrumbs;
  5. /**
  6. * @var $this \yii\base\View
  7. * @var $content string
  8. */
  9. app\config\AppAsset::register($this);
  10. ?>
  11. <?php $this->beginPage(); ?>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14. <head>
  15. <meta charset="utf-8"/>
  16. <title><?php echo Html::encode($this->title); ?></title>
  17. <?php $this->head(); ?>
  18. </head>
  19. <body>
  20. <?php $this->beginBody(); ?>
  21. <div class="navbar navbar-inverse navbar-fixed-top">
  22. <div class="container">
  23. <?php echo Html::a('My Company', Yii::$app->homeUrl, array('class' => 'navbar-brand')); ?>
  24. <div class="nav-collapse collapse pull-right">
  25. <?php echo Menu::widget(array(
  26. 'options' => array('class' => 'nav navbar-nav'),
  27. 'items' => array(
  28. array('label' => 'Home', 'url' => array('/site/index')),
  29. array('label' => 'About', 'url' => array('/site/about')),
  30. array('label' => 'Contact', 'url' => array('/site/contact')),
  31. Yii::$app->user->isGuest ?
  32. array('label' => 'Login', 'url' => array('/site/login')) :
  33. array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
  34. ),
  35. )); ?>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="container">
  40. <?php echo Breadcrumbs::widget(array(
  41. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
  42. )); ?>
  43. <?php echo $content; ?>
  44. </div>
  45. <footer class="footer">
  46. <div class="container">
  47. <p class="pull-left">&copy; My Company <?php echo date('Y'); ?></p>
  48. <p class="pull-right"><?php echo Yii::powered(); ?></p>
  49. </div>
  50. </footer>
  51. <?php $this->endBody(); ?>
  52. </body>
  53. </html>
  54. <?php $this->endPage(); ?>