Forum implementiert #34
@@ -24,6 +24,11 @@ if (isset($_GET["id"])) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!--
|
||||
Seite: Anzeige für Beiträge
|
||||
Funktion: Stellt einen übergebenen Beitrag dar.
|
||||
-->
|
||||
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
|
||||
|
||||
<main class="article-view-container">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
@@ -32,8 +37,30 @@ if (isset($_GET["id"])) {
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_id"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "article_updated"): ?>
|
||||
<p class="alert-message is-success">
|
||||
Dein Beitrag wurde erfolgreich bearbeitet!
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
|
||||
<?php unset($_SESSION["message"]); ?>
|
||||
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
|
||||
<!-- Metadaten & Titel -->
|
||||
|
||||
<div class="article-view-top-section">
|
||||
<?php if (isset($category) && !empty($category)): ?>
|
||||
<span class="article-view-category"><?php echo htmlspecialchars($category); ?></span>
|
||||
@@ -52,13 +79,18 @@ if (isset($_GET["id"])) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Beitrags-Inhalt -->
|
||||
|
||||
<div class="article-view-content">
|
||||
<?php if (isset($content)): ?>
|
||||
<!-- nl2br für Zeilenumbrüche -->
|
||||
<div class="article-view-body">
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
? ?
|
||||
<?php echo nl2br(htmlspecialchars($content)); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<!-- Beitrags-Endbereich (Tags) -->
|
||||
|
||||
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
? ?
|
||||
<?php if (isset($tags) && !empty($tags)): ?>
|
||||
<div class="article-view-bottom-section">
|
||||
@@ -66,6 +98,7 @@ if (isset($_GET["id"])) {
|
||||
|
||||
<div class="article-view-tags-list">
|
||||
<?php
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
? ?
|
||||
// Falls $tags ein String ist (z.B. "Web, CSS"), in ein Array umwandeln
|
||||
$tagArray = is_array($tags) ? $tags : explode(',', $tags);
|
||||
|
||||
foreach ($tagArray as $tag):
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/* Container für den gesamten articleikel */
|
||||
.article-view-container {
|
||||
box-sizing: border-box;
|
||||
max-width: 900px;
|
||||
max-width: 900px; /* Angenehme Lesebreite für längere Texte */
|
||||
margin: 3rem auto;
|
||||
padding: 0 2rem;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
@@ -105,7 +105,7 @@
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* Responsive Anpassungen unter 760px */
|
||||
/* Responsive Anpassungen unter 760px (für z.B. Smarticlephones) */
|
||||
@media (max-width: 760px) {
|
||||
.article-view-container {
|
||||
margin: 1.5rem auto;
|
||||
|
||||
@@ -52,6 +52,7 @@ if ($pfad === "deleteAccount") {
|
||||
<link rel="stylesheet" href="css/showArticle.css">
|
||||
<link rel="stylesheet" href="css/message.css">
|
||||
|
||||
<script src="js/paginator.js" async></script>
|
||||
<script src="js/comments.js" defer></script>
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
Warum löscht du das Skript?! Warum löscht du das Skript?!
|
||||
|
||||
<title>EduForge</title>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
Bitte vorher prüfen, ob die Session schon gestartet wurde. Bitte vorher prüfen, ob die Session schon gestartet wurde.
|
||||
session_start();
|
||||
}
|
||||
|
||||
header("Content-Type: application/json");
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class DatabaseCommentManager implements CommentManagerDAO
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException("Kommentardatenbank konnte nicht erstellt werden.");
|
||||
throw new RuntimeException("internal_error");
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
Die genaue Formulierung der Fehlernachrichten wird ja in den views übernommen. Hier könnte man Fehlerkürzel wie Die genaue Formulierung der Fehlernachrichten wird ja in den views übernommen. Hier könnte man Fehlerkürzel wie
RuntimeException("internal_error") verwenden. In der view wird aus der Exception dann gelesen, was in dieser Stand. Wenn dort dann internal_error stand, dann wird eine bestimmte Fehlernachricht angezeigt.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class DatabaseCommentManager implements CommentManagerDAO
|
||||
return $db;
|
||||
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException("Verbindung zur Kommentardatenbank fehlgeschlagen.");
|
||||
throw new RuntimeException("internal_error");
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
s. oben s. oben
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class DatabaseCommentManager implements CommentManagerDAO
|
||||
return intval($db->lastInsertId());
|
||||
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException("Kommentar konnte nicht gespeichert werden.");
|
||||
throw new RuntimeException("internal_error");
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
s. oben s. oben
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class DatabaseCommentManager implements CommentManagerDAO
|
||||
return $this->mapRowsToComments($command);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException("Kommentare konnten nicht geladen werden.");
|
||||
throw new RuntimeException("internal_error");
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
s. oben s. oben
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class DatabaseCommentManager implements CommentManagerDAO
|
||||
return $this->mapRowsToComments($command);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
throw new RuntimeException("Kommentare konnten nicht geladen werden.");
|
||||
throw new RuntimeException("internal_error");
|
||||
|
caroline.slt marked this conversation as resolved
Outdated
niklas.ortmann
commented
s. oben s. oben
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
Warum?