<?php
include "internal/mysql.php";
if(isset($_GET["template"])){
    $title = "[TITLE]";
    $content = "[CONTENT]";
    $date = "DATE NOT SHOWN IN PREVIEW";
    $id = "0";

} else{
    $id = $conn->real_escape_string($_GET["id"]);
    $result = $conn->query("SELECT * FROM posts WHERE id=$id");
    if ($result->num_rows > 0) {
        $row = $result->fetch_assoc();
    } else {
        die("Post not found");
    }

    $title = $row["title"];
    $content = $row["content"];
    $date = $row["date"];
    $id = $row["id"];
}


?>

<!DOCTYPE html>
<html lang="de">
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo($title); ?> - Jonas Leder</title>

    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/normalize.css" rel="stylesheet">
    <link href="/css/sourcesanspro.css" rel="stylesheet">
    <link href="/css/menue.css" rel="stylesheet">
    <script src="https://kit.fontawesome.com/038c6c1f0e.js" crossorigin="anonymous"></script>
    <!-- Matomo Image Tracker-->
    <img src="https://matomo.jonasled.de/matomo.php?idsite=1&amp;rec=1" style="border:0" alt="" />
    <!-- End Matomo -->
</head>
<body>
<header>
    <div class="header-wrapper">
        <div class="header-homepage  color-overlay" data-parallax-depth="20">
            <div class="header-description gridContainer content-on-center">
                <div class="row header-description-row">
                    <div class="header-content header-content-centered">
                        <div class="align-holder">
                            <h1 class="heading8"><?php echo($title); ?></h1>
                            <p class="header-subtitle"> </p>
                            <div class="header-buttons-wrapper"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="header-separator header-separator-bottom ">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none">
                <path class="svg-white-bg" d="M737.9,94.7L0,0v100h1000V0L737.9,94.7z"></path>
            </svg>
        </div>
    </div>
    <div id="mainMenu" includeHTML="/include/menue.php"></div>
</header>
<div id="content">
    <p>
        <?php echo($content); ?>
    </p>
</div>
<footer includeHTML="/include/footer.php">
</footer>
<script src="/js/includeHTML.js"></script>
</body>
</html>