|
- <?php
-
- declare(strict_types=1);
-
- use Cartalyst\Sentinel\Native\Facades\Sentinel;
-
- $navigationItems = [
- ['label' => 'Home', 'href' => '/'],
- ['label' => 'Example JSON', 'href' => '/users/123'],
- ];
-
- $currentPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
- $currentPath = is_string($currentPath) && $currentPath !== '' ? $currentPath : '/';
-
- $currentUser = Sentinel::check();
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title><?= e($pageTitle ?? 'MindVisionCode PHP') ?></title>
- <link rel="stylesheet" href="<?= e(asset('css/site.css')) ?>">
- </head>
- <body>
- <div class="page-shell">
- <header class="site-header">
- <div class="container header-inner">
- <a class="brand" href="/">
- <span class="brand-mark">MV</span>
- <span class="brand-copy">
- <strong>MindVisionCode</strong>
- <small>PHP MVC</small>
- </span>
- </a>
-
- <nav class="site-nav" aria-label="Primary navigation">
- <?php foreach ($navigationItems as $item): ?>
- <?php $isActive = $currentPath === $item['href']; ?>
- <a class="nav-link<?= $isActive ? ' is-active' : '' ?>" href="<?= e($item['href']) ?>">
- <?= e($item['label']) ?>
- </a>
- <?php endforeach; ?>
-
- <?php if ($currentUser): ?>
- <form class="auth-nav-form" method="POST" action="/logout">
- <?= csrf_field() ?>
- <button class="auth-nav-btn" type="submit">Sign out</button>
- </form>
- <?php else: ?>
- <a class="nav-link<?= $currentPath === '/login' ? ' is-active' : '' ?>" href="/login">Sign in</a>
- <?php endif; ?>
- </nav>
- </div>
- </header>
|