Website/index.php
2020-11-25 16:59:57 +01:00

75 lines
2.4 KiB
PHP

<!--?xml version="1.0" encoding="utf-8"?-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-de" dir="ltr" lang="de-de">
<?php
include "conf.php";
$res = $mysqli->query("select * from pages order by ord asc");
$page = $_GET["p"] ?? "";
$nav = "";
if ($res->num_rows>1) {
$nav = "<ul>";
while ($pages = $res->fetch_assoc()) {
if (""==$page) {
$page = $pages["name"];
}
$nav.= "<a class='".($page==$pages["name"] ? "current" : "")."' href='?p=".$pages["name"]."'><li>".$pages["name"]."</li></a>";
}
$nav.= "</ul>";
}
$headerclass = isset($_GET["p"]) ? "shortened" : "full";
if ($stmt = $mysqli->prepare("select * from articles where page = ? order by ord asc")) {
$stmt->bind_param("s", $page);
$stmt->execute();
$res = $stmt->get_result();
$back_white = "white";
$articles = "";
$calls = "";
while ($article = $res->fetch_assoc()) {
$articles.= "<article class='".$back_white."' id='".$article["name"]."'></article>\n";
$section = "";
if (is_array($_GET["a"][$article["name"]])) {
foreach ($_GET["a"][$article["name"]] as $key => $val) {
if (""!=$section)
$section.= ", ";
$section.= "'".$key."': ".$val;
}
$section = "{".$section."}";
} else {
$section = "'".($_GET["a"][$article["name"]] ?? "")."'";
}
$calls.= "loadArticle('".$article["src"]."', '".$article["name"]."', ".$section.", true);\n";
$back_white = ($back_white=="white" ? "gray" : "white");
}
}
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="author" content="Nils Otterpohl">
<title>Ortsfeuerwehr Braunschweig Innenstadt</title>
<link href="https://www.fw-innenstadt.de/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
<link rel="stylesheet" href="ext/baguetteBox.min.css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="ext/baguetteBox.min.js" async></script>
<script src="script.js"></script>
</head>
<body>
<header class="<?=$headerclass;?>">
<div id="wappen">
<a href="https://www.fw-innenstadt.de/"><img id="iwappen" src="img/wappen.svg" title="Wappen der OF Innenstadt"></a>
</div>
<div id="sitetitle">OF Innenstadt</div>
<div id="slogan">
Durch Vielfalt einzigartig!
</div>
</header>
<nav><?=$nav;?></nav>
<main id="main"><?=$articles;?></main>
</body>
</html>
<script type="text/javascript">
var urlgen = new URLGenerator("<?=$page;?>");
<?=$calls;?>
</script>