main.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\bootstrap\Nav;
  4. use yii\bootstrap\NavBar;
  5. use yii\widgets\Breadcrumbs;
  6. /**
  7. * @var $this \yii\base\View
  8. * @var $content string
  9. */
  10. app\config\AppAsset::register($this);
  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. <?php $this->beginBody(); ?>
  22. <?php
  23. NavBar::begin(array(
  24. 'brandLabel' => 'My Company',
  25. 'brandUrl' => Yii::$app->homeUrl,
  26. 'options' => array(
  27. 'class' => 'navbar-inverse navbar-fixed-top',
  28. ),
  29. ));
  30. echo Nav::widget(array(
  31. 'options' => array('class' => 'navbar-nav pull-right'),
  32. 'items' => array(
  33. array('label' => 'Home', 'url' => array('/site/index')),
  34. array('label' => 'About', 'url' => array('/site/about')),
  35. array('label' => 'Contact', 'url' => array('/site/contact')),
  36. Yii::$app->user->isGuest ?
  37. array('label' => 'Login', 'url' => array('/site/login')) :
  38. array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')),
  39. )));
  40. NavBar::end();
  41. ?>
  42. <div class="container">
  43. <?php echo Breadcrumbs::widget(array(
  44. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
  45. )); ?>
  46. <?php echo $content; ?>
  47. </div>
  48. <footer class="footer">
  49. <div class="container">
  50. <p class="pull-left">&copy; My Company <?php echo date('Y'); ?></p>
  51. <p class="pull-right"><?php echo Yii::powered(); ?></p>
  52. </div>
  53. </footer>
  54. <?php $this->endBody(); ?>
  55. </body>
  56. </html>
  57. <?php $this->endPage(); ?>