Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

56 wiersze
2.1KB

  1. <?php
  2. declare(strict_types=1);
  3. use Cartalyst\Sentinel\Native\Facades\Sentinel;
  4. $navigationItems = [
  5. ['label' => 'Home', 'href' => '/'],
  6. ['label' => 'Example JSON', 'href' => '/users/123'],
  7. ];
  8. $currentPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
  9. $currentPath = is_string($currentPath) && $currentPath !== '' ? $currentPath : '/';
  10. $currentUser = Sentinel::check();
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14. <head>
  15. <meta charset="UTF-8">
  16. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  17. <title><?= e($pageTitle ?? 'MindVisionCode PHP') ?></title>
  18. <link rel="stylesheet" href="<?= e(asset('css/site.css')) ?>">
  19. </head>
  20. <body>
  21. <div class="page-shell">
  22. <header class="site-header">
  23. <div class="container header-inner">
  24. <a class="brand" href="/">
  25. <span class="brand-mark">MV</span>
  26. <span class="brand-copy">
  27. <strong>MindVisionCode</strong>
  28. <small>PHP MVC</small>
  29. </span>
  30. </a>
  31. <nav class="site-nav" aria-label="Primary navigation">
  32. <?php foreach ($navigationItems as $item): ?>
  33. <?php $isActive = $currentPath === $item['href']; ?>
  34. <a class="nav-link<?= $isActive ? ' is-active' : '' ?>" href="<?= e($item['href']) ?>">
  35. <?= e($item['label']) ?>
  36. </a>
  37. <?php endforeach; ?>
  38. <?php if ($currentUser): ?>
  39. <form class="auth-nav-form" method="POST" action="/logout">
  40. <?= csrf_field() ?>
  41. <button class="auth-nav-btn" type="submit">Sign out</button>
  42. </form>
  43. <?php else: ?>
  44. <a class="nav-link<?= $currentPath === '/login' ? ' is-active' : '' ?>" href="/login">Sign in</a>
  45. <?php endif; ?>
  46. </nav>
  47. </div>
  48. </header>

Powered by TurnKey Linux.