feat: Navigation hinzugefügt und URL-Struktur in .htaccess optimiert

This commit is contained in:
Troy Grunt
2026-02-07 22:22:03 +01:00
parent 4f32bf68ca
commit de352e0335
3 changed files with 35 additions and 5 deletions

View File

@@ -20,7 +20,9 @@ RewriteEngine On
# Alles auf index.php umleiten, außer echte Dateien/Verzeichnisse # Alles auf index.php umleiten, außer echte Dateien/Verzeichnisse
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L] RewriteRule ^([a-z\-]*)$ index.php?module=$1 [QSA,L]
RewriteRule ^([a-z\-]*)/([a-z]*)$ index.php?module=$1&action=$2 [QSA,L]
RewriteRule ^$ index.php [QSA,L]
# ========================= # =========================
# Standard-Dokument # Standard-Dokument

View File

@@ -75,7 +75,7 @@
</td> </td>
<td> <td>
<a href="/?page=floors/edit&id=1">Bearbeiten</a> <a href="/floors/edit?id=1">Bearbeiten</a>
<button>Löschen</button> <button>Löschen</button>
</td> </td>
</tr> </tr>
@@ -91,6 +91,6 @@
<?php /* if (empty($floors)): */ ?> <?php /* if (empty($floors)): */ ?>
<div class="empty-state"> <div class="empty-state">
<p>Noch keine Stockwerke angelegt.</p> <p>Noch keine Stockwerke angelegt.</p>
<p><a href="/?page=floors/edit">Erstes Stockwerk anlegen</a></p> <p><a href="/floors/edit">Erstes Stockwerk anlegen</a></p>
</div> </div>
<?php /* endif; */ ?> <?php /* endif; */ ?>

View File

@@ -26,8 +26,36 @@
<header> <header>
<h1>Netzwerk-Dokumentation</h1> <h1>Netzwerk-Dokumentation</h1>
<!-- TODO: Navigation einfügen --> <?php
<!-- Beispiel: Links zu Dashboard, Gerätetypen, Geräte, Racks, Floors, Connections --> $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> </header>
<main> <main>