LayoutView.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Pockit\Views;
  3. // Класс разметки
  4. class LayoutView extends View {
  5. protected $page_title;
  6. protected $crumbs = array();
  7. protected function breadcrumbs() { ?>
  8. <nav class="breadcrumb">
  9. <ul>
  10. <?php foreach ($this->crumbs as $crumb => $url) {
  11. if ($crumb === array_key_last($this->crumbs)) { ?>
  12. <li class="breadcrumb-item active"><?= $crumb ?></li>
  13. <?php } else { ?>
  14. <li class="breadcrumb-item"><a href="<?= $url ?>"><?= $crumb ?></a></li>
  15. <?php } ?>
  16. <?php } ?>
  17. </ul>
  18. </nav>
  19. <?php }
  20. protected function customHead() {}
  21. protected function customScripts() {}
  22. public function view() : void { ?>
  23. <!DOCTYPE html>
  24. <html lang="ru">
  25. <head>
  26. <meta charset="UTF-8">
  27. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  28. <meta http-equiv="Cache-control" content="public">
  29. <title><?= $this->page_title ?> | Карманный сервер</title>
  30. <link rel='icon' type='image/png' href='/img/favicon.png'>
  31. <link rel="stylesheet" href="/css/pockit.css">
  32. <link rel="stylesheet" href="/css/spinner.css">
  33. <?php $this->customHead() ?>
  34. </head>
  35. <body>
  36. <?php $this->breadcrumbs(); ?>
  37. <?php $this->content(); ?>
  38. <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
  39. <script src="/js/pockit.js"></script>
  40. <?php $this->customScripts(); ?>
  41. </body>
  42. </html>
  43. <?php }
  44. }