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
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();
}
include_once 'php/controller/home-controller.php';
?>
<!--
+18 -26
View File
@@ -4,53 +4,44 @@
-->
<?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) -->
<main class="art-view-container">
<!-- Artikel-Kopfdaten (Metadaten & Titel) -->
<div class="art-view-top-section">
<main class="flexbox">
<div class="container">
<!-- Metadaten & Titel -->
<div class="article-view-top-section">
<?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; ?>
<h1 class="art-view-title">
<h1 class="article-view-title">
<?php if (isset($title)) { echo htmlspecialchars($title); } ?>
</h1>
<div class="art-view-meta">
<div class="article-view-meta">
<?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; ?>
</div>
</div>
<!-- Artikel-Inhalt -->
<div class="art-view-content">
<!-- articleikel-Inhalt -->
<div class="article-view-content">
<?php if (isset($content)): ?>
<!-- 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; ?>
</div>
<!-- Artikel-Endbereich (Tags) -->
<!-- articleikel-Endbereich (Tags) -->
<?php if (isset($tags) && !empty($tags)): ?>
<div class="art-view-bottom-section">
<div class="art-view-tags-label">Tags:</div>
<div class="art-view-tags-list">
<div class="article-view-bottom-section">
<div class="article-view-tags-label">Tags:</div>
<div class="article-view-tags-list">
<?php
// Falls $tags ein String ist (z.B. "Web, CSS"), in ein Array umwandeln
$tagArray = is_array($tags) ? $tags : explode(',', $tags);
@@ -58,7 +49,7 @@ include_once 'php/controller/showArticle-controller.php';
$trimmedTag = trim($tag);
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
endif;
endforeach;
@@ -66,6 +57,7 @@ include_once 'php/controller/showArticle-controller.php';
</div>
</div>
<?php endif; ?>
</div>
</main>