feat: Navigation hinzugefügt und URL-Struktur in .htaccess optimiert
This commit is contained in:
@@ -20,7 +20,9 @@ RewriteEngine On
|
||||
# Alles auf index.php umleiten, außer echte Dateien/Verzeichnisse
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
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
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="/?page=floors/edit&id=1">Bearbeiten</a>
|
||||
<a href="/floors/edit?id=1">Bearbeiten</a>
|
||||
<button>Löschen</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -91,6 +91,6 @@
|
||||
<?php /* if (empty($floors)): */ ?>
|
||||
<div class="empty-state">
|
||||
<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>
|
||||
<?php /* endif; */ ?>
|
||||
|
||||
@@ -26,8 +26,36 @@
|
||||
<header>
|
||||
<h1>Netzwerk-Dokumentation</h1>
|
||||
|
||||
<!-- TODO: Navigation einfügen -->
|
||||
<!-- Beispiel: Links zu Dashboard, Gerätetypen, Geräte, Racks, Floors, Connections -->
|
||||
<?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>
|
||||
|
||||
Reference in New Issue
Block a user