home-controller.php

This commit is contained in:
2026-05-29 12:09:04 +02:00
parent 938cca55fe
commit 3edc689e5f
4 changed files with 54 additions and 59 deletions
+1 -15
View File
@@ -1,19 +1,5 @@
<?php <?php
session_start(); include_once 'php/controller/home-controller.php';
require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php';
require_once 'php/model/LocalArticleManager.php';
try {
$articleManager = ArticleManager::getInstance();
// Beziehen der Dummy-Beiträge aus dem ArticleManager:
$dummy1 = $articleManager->getArticle(1);
$dummy2 = $articleManager->getArticle(2);
$dummy3 = $articleManager->getArticle(3);
} catch (Exception $e){
$_SESSION["message"] = "internal_error";
echo "Fehler aufgetreten: " . $e->getMessage();
}
?> ?>
<!-- <!--
+18 -26
View File
@@ -4,53 +4,44 @@
--> -->
<?php <?php
include_once 'php/controller/showArticle-controller.php'; include_once 'php/controller/showarticleicle-controller.php';
?> ?>
<!--<main>
<h1><?php if (isset($title)) {echo $title;} ?></h1>
<p>
<?php if (isset($content)) {echo $content;} ?>
</p>
</main>-->
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) --> <!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
<main class="art-view-container"> <main class="flexbox">
<div class="container">
<!-- Artikel-Kopfdaten (Metadaten & Titel) --> <!-- Metadaten & Titel -->
<div class="art-view-top-section"> <div class="article-view-top-section">
<?php if (isset($category) && !empty($category)): ?> <?php if (isset($category) && !empty($category)): ?>
<span class="art-view-category"><?php echo htmlspecialchars($category); ?></span> <span class="article-view-category"><?php echo htmlspecialchars($category); ?></span>
<?php endif; ?> <?php endif; ?>
<h1 class="art-view-title"> <h1 class="article-view-title">
<?php if (isset($title)) { echo htmlspecialchars($title); } ?> <?php if (isset($title)) { echo htmlspecialchars($title); } ?>
</h1> </h1>
<div class="art-view-meta"> <div class="article-view-meta">
<?php if (isset($author) && !empty($author)): ?> <?php if (isset($author) && !empty($author)): ?>
<span class="art-view-author">Von: <strong><?php echo htmlspecialchars($author); ?></strong></span> <span class="article-view-author">Von: <strong><?php echo htmlspecialchars($author); ?></strong></span>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<!-- Artikel-Inhalt --> <!-- articleikel-Inhalt -->
<div class="art-view-content"> <div class="article-view-content">
<?php if (isset($content)): ?> <?php if (isset($content)): ?>
<!-- nl2br für Zeilenumbrüche --> <!-- nl2br für Zeilenumbrüche -->
<div class="art-view-body"><?php echo nl2br(htmlspecialchars($content)); ?></div> <div class="article-view-body"><?php echo nl2br(htmlspecialchars($content)); ?></div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<!-- Artikel-Endbereich (Tags) --> <!-- articleikel-Endbereich (Tags) -->
<?php if (isset($tags) && !empty($tags)): ?> <?php if (isset($tags) && !empty($tags)): ?>
<div class="art-view-bottom-section"> <div class="article-view-bottom-section">
<div class="art-view-tags-label">Tags:</div> <div class="article-view-tags-label">Tags:</div>
<div class="art-view-tags-list"> <div class="article-view-tags-list">
<?php <?php
// Falls $tags ein String ist (z.B. "Web, CSS"), in ein Array umwandeln // Falls $tags ein String ist (z.B. "Web, CSS"), in ein Array umwandeln
$tagArray = is_array($tags) ? $tags : explode(',', $tags); $tagArray = is_array($tags) ? $tags : explode(',', $tags);
@@ -58,7 +49,7 @@ include_once 'php/controller/showArticle-controller.php';
$trimmedTag = trim($tag); $trimmedTag = trim($tag);
if (!empty($trimmedTag)): if (!empty($trimmedTag)):
?> ?>
<span class="art-view-tag-item"><?php echo htmlspecialchars($trimmedTag); ?></span> <span class="article-view-tag-item"><?php echo htmlspecialchars($trimmedTag); ?></span>
<?php <?php
endif; endif;
endforeach; endforeach;
@@ -66,6 +57,7 @@ include_once 'php/controller/showArticle-controller.php';
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div>
</main> </main>
+18 -18
View File
@@ -1,5 +1,5 @@
/* Container für den gesamten Artikel */ /* Container für den gesamten articleikel */
.art-view-container { .article-view-container {
box-sizing: border-box; box-sizing: border-box;
max-width: 900px; /* Angenehme Lesebreite für längere Texte */ max-width: 900px; /* Angenehme Lesebreite für längere Texte */
margin: 3rem auto; margin: 3rem auto;
@@ -9,19 +9,19 @@
line-height: 1.6; line-height: 1.6;
} }
.art-view-container * { .article-view-container * {
box-sizing: border-box; box-sizing: border-box;
} }
/* --- KOPFDATEN-BEREICH --- */ /* --- KOPFDATEN-BEREICH --- */
.art-view-top-section { .article-view-top-section {
margin-bottom: 2.5rem; margin-bottom: 2.5rem;
border-bottom: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
padding-bottom: 1.5rem; padding-bottom: 1.5rem;
} }
/* Kategorie-Badge */ /* Kategorie-Badge */
.art-view-category { .article-view-category {
display: inline-block; display: inline-block;
background-color: #ebf8ff; background-color: #ebf8ff;
color: #2b6cb0; color: #2b6cb0;
@@ -35,7 +35,7 @@
} }
/* Hauptüberschrift */ /* Hauptüberschrift */
.art-view-title { .article-view-title {
font-size: 2.5rem; font-size: 2.5rem;
color: #1a202c; color: #1a202c;
line-height: 1.2; line-height: 1.2;
@@ -44,28 +44,28 @@
} }
/* Autoren-Zeile */ /* Autoren-Zeile */
.art-view-meta { .article-view-meta {
font-size: 0.95rem; font-size: 0.95rem;
color: #4a5568; color: #4a5568;
} }
.art-view-author strong { .article-view-author strong {
color: #2d3748; color: #2d3748;
} }
/* --- INHALT --- */ /* --- INHALT --- */
.art-view-content { .article-view-content {
margin-bottom: 3rem; margin-bottom: 3rem;
} }
.art-view-body { .article-view-body {
font-size: 1.125rem; font-size: 1.125rem;
color: #2d3748; color: #2d3748;
white-space: pre-line; white-space: pre-line;
} }
/* --- TAG-BEREICH --- */ /* --- TAG-BEREICH --- */
.art-view-bottom-section { .article-view-bottom-section {
border-top: 1px solid #e2e8f0; border-top: 1px solid #e2e8f0;
padding-top: 1.5rem; padding-top: 1.5rem;
display: flex; display: flex;
@@ -73,7 +73,7 @@
gap: 0.5rem; gap: 0.5rem;
} }
.art-view-tags-label { .article-view-tags-label {
font-size: 0.9rem; font-size: 0.9rem;
font-weight: 600; font-weight: 600;
color: #718096; color: #718096;
@@ -81,14 +81,14 @@
letter-spacing: 0.05em; letter-spacing: 0.05em;
} }
.art-view-tags-list { .article-view-tags-list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 0.5rem; gap: 0.5rem;
} }
/* Einzelner Tag */ /* Einzelner Tag */
.art-view-tag-item { .article-view-tag-item {
background-color: #f1f5f9; background-color: #f1f5f9;
color: #475569; color: #475569;
font-size: 0.85rem; font-size: 0.85rem;
@@ -99,20 +99,20 @@
transition: background-color 0.2s, color 0.2s; transition: background-color 0.2s, color 0.2s;
} }
.art-view-tag-item:hover { .article-view-tag-item:hover {
background-color: #e2e8f0; background-color: #e2e8f0;
color: #1e293b; color: #1e293b;
cursor: default; cursor: default;
} }
/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */ /* Responsive Anpassungen unter 760px (für z.B. Smarticlephones) */
@media (max-width: 760px) { @media (max-width: 760px) {
.art-view-container { .article-view-container {
margin: 1.5rem auto; margin: 1.5rem auto;
padding: 0 1rem; padding: 0 1rem;
} }
.art-view-title { .article-view-title {
font-size: 1.85rem; font-size: 1.85rem;
} }
} }
+17
View File
@@ -0,0 +1,17 @@
<?php
session_start();
require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php';
require_once 'php/model/LocalArticleManager.php';
try {
$articleManager = ArticleManager::getInstance();
// Beziehen der Dummy-Beiträge aus dem ArticleManager:
$dummy1 = $articleManager->getArticle(1);
$dummy2 = $articleManager->getArticle(2);
$dummy3 = $articleManager->getArticle(3);
} catch (Exception $e){
$_SESSION["message"] = "internal_error";
echo "Fehler aufgetreten: " . $e->getMessage();
}
?>