Files
netwatch/app/templates/header.php

62 lines
1.5 KiB
PHP

<?php
/**
* header.php
*
* HTML-Kopf, CSS / JS einbinden, Navigation
* Wird am Anfang jeder Seite eingebunden
*/
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Netzwerk-Dokumentation</title>
<!-- CSS -->
<link rel="stylesheet" href="/assets/css/app.css">
<!-- JS -->
<script src="/assets/js/app.js" defer></script>
<script src="/assets/js/svg-editor.js" defer></script>
<script src="/assets/js/network-view.js" defer></script>
<!-- TODO: Meta-Tags, Favicon -->
</head>
<body>
<header>
<h1>Netzwerk-Dokumentation</h1>
<?php
$currentPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$navItems = [
'/' => 'Dashboard',
'/device-types' => 'Gerätetypen',
'/devices' => 'Geräte',
'/racks' => 'Racks',
'/floors' => 'Grundrisse',
'/connections' => 'Verbindungen',
];
?>
<nav class="main-nav">
<ul>
<?php foreach ($navItems as $url => $label): ?>
<?php
$active = ($currentPath === $url || str_starts_with($currentPath, $url . '/'))
? 'active'
: '';
?>
<li class="<?= $active ?>">
<a href="<?= htmlspecialchars($url) ?>">
<?= htmlspecialchars($label) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</nav>
</header>
<main>