main.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. ));
  41. NavBar::end();
  42. ?>
  43. <div class="container">
  44. <?php echo Breadcrumbs::widget(array(
  45. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
  46. )); ?>
  47. <?php echo $content; ?>
  48. </div>
  49. <footer class="footer">
  50. <div class="container">
  51. <p class="pull-left">&copy; My Company <?php echo date('Y'); ?></p>
  52. <p class="pull-right"><?php echo Yii::powered(); ?></p>
  53. </div>
  54. </footer>
  55. <?php $this->endBody(); ?>
  56. </body>
  57. </html>
  58. <?php $this->endPage(); ?>