This commit is contained in:
2025-11-28 03:31:46 +01:00
parent 5de109b649
commit cf68494f55
7 changed files with 132 additions and 12 deletions

View File

@@ -6,9 +6,16 @@ $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https'
$host = $_SERVER['HTTP_HOST'] ?? app_primary_domain();
$baseUrl = $scheme . '://' . $host;
// Wenn $navAnchors NICHT gesetzt ist → leeres Array
// Aktueller Page-Key (z.B. 'landing', 'fakecheck', 'dashboard')
$pageKey = $GLOBALS['pageKey'] ?? null;
// Nav-Anker: wenn nicht explizit gesetzt, aus der i18n-JSON holen
if (!isset($navAnchors) || !is_array($navAnchors)) {
$navAnchors = [];
if ($pageKey && function_exists('app_get_nav_anchors')) {
$navAnchors = app_get_nav_anchors($pageKey); // ['href' => '#how', 'label' => '...']
} else {
$navAnchors = [];
}
}
// Session sollte in config/fileload.php bereits gestartet sein.
@@ -112,14 +119,16 @@ function build_lang_url(string $code, string $path, array $query): string
<div class="flex items-center gap-6">
<!-- Hauptnavigation -->
<nav class="flex flex-wrap items-center gap-4 sm:gap-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
<?php foreach ($navAnchors as $item): ?>
<a href="<?= htmlspecialchars($item['href']) ?>"
class="hover:text-brand-primary transition-colors"
data-i18n="<?= htmlspecialchars($item['key']) ?>">
</a>
<?php endforeach; ?>
</nav>
<?php if (!empty($navAnchors)): ?>
<nav class="flex flex-wrap items-center gap-4 sm:gap-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
<?php foreach ($navAnchors as $item): ?>
<a href="<?= htmlspecialchars($item['href'] ?? '#') ?>"
class="hover:text-brand-primary transition-colors">
<?= htmlspecialchars($item['label'] ?? '') ?>
</a>
<?php endforeach; ?>
</nav>
<?php endif; ?>
<!-- Language Switcher -->
<div class="relative">