This commit is contained in:
2025-11-29 01:57:38 +01:00
parent cc7ec65685
commit d63acce8f7
3 changed files with 226 additions and 117 deletions

View File

@@ -1,10 +1,8 @@
<?php
// partials/structure/header.php
// Aktuelle Domain + Protokoll
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? app_primary_domain();
$baseUrl = $scheme . '://' . $host;
// Aktuelle Basis-URL der laufenden Instanz (staging, prod, etc.)
$baseUrl = app_current_base_url();
// Aktueller Page-Key (z.B. 'landing', 'fakecheck', 'dashboard')
$pageKey = $GLOBALS['pageKey'] ?? null;
@@ -84,7 +82,7 @@ $currentLangLabel = $currentLangInfo['label'] ?? $currentLangCode;
// -----------------------------------------
// Helper: URL mit anderem ?lang=.. bauen
// -----------------------------------------
$currentPath = strtok($_SERVER['REQUEST_URI'] ?? '/', '?');
$currentPath = app_current_path();
$currentQuery = $_GET ?? [];
function build_lang_url(string $code, string $path, array $query): string
@@ -95,8 +93,7 @@ function build_lang_url(string $code, string $path, array $query): string
}
?>
<header class="sticky top-0 z-40 border-b border-brand-border/70 backdrop-blur bg-brand-bg/85">
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8 flex items-center justify-between min-h-16 py-2">
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8 flex items-center justify-between min-h-16 py-2">
<!-- Logo -->
<div class="flex items-center gap-3">
@@ -120,27 +117,23 @@ function build_lang_url(string $code, string $path, array $query): string
<div class="flex items-center gap-6">
<!-- Hauptnavigation -->
<!-- Hauptnavigation -->
<?php if (!empty($navAnchors)): ?>
<nav class="flex flex-wrap items-center gap-x-4 gap-y-1 sm:gap-x-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
<?php foreach ($navAnchors as $item): ?>
<?php
$href = $item['href'] ?? '#';
$label = $item['label'] ?? '';
$i18nKey = $item['i18n'] ?? '';
?>
<a href="<?= htmlspecialchars($href) ?>"
class="hover:text-brand-primary transition-colors"
<?php if ($i18nKey !== ''): ?>
data-i18n="<?= htmlspecialchars($i18nKey) ?>"
<?php endif; ?>
><?= htmlspecialchars($label) ?></a>
<?php endforeach; ?>
</nav>
<?php endif; ?>
<?php if (!empty($navAnchors)): ?>
<nav class="flex flex-wrap items-center gap-x-4 gap-y-1 sm:gap-x-6 text-xs font-medium text-brand-muted uppercase tracking-[0.18em]">
<?php foreach ($navAnchors as $item): ?>
<?php
$href = $item['href'] ?? '#';
$label = $item['label'] ?? '';
$i18nKey = $item['i18n'] ?? '';
?>
<a href="<?= htmlspecialchars($href) ?>"
class="hover:text-brand-primary transition-colors"
<?php if ($i18nKey !== ''): ?>
data-i18n="<?= htmlspecialchars($i18nKey) ?>"
<?php endif; ?>
><?= htmlspecialchars($label) ?></a>
<?php endforeach; ?>
</nav>
<?php endif; ?>
<!-- Language Switcher -->
<div class="relative">