Update showArticle-controller.php

This commit is contained in:
2026-05-29 11:41:46 +02:00
parent f2c0b4e4b5
commit 1f2be8b8ee
+10 -6
View File
@@ -3,16 +3,20 @@ session_start();
require_once 'php/model/Article.php'; require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php'; require_once 'php/model/ArticleManager.php';
echo "test";
if (isset($_GET["id"])){ if (isset($_GET["id"])){
try { try {
$articleManager = ArticleManager::getInstance(); $articleManager = ArticleManager::getInstance();
$article = $articleManager->getArticle($_GET["id"]); $article = $articleManager->getArticle($_GET["id"]);
$title = $article->getTitle(); if($article != null){
$content = $article->getContent(); $title = $article->getTitle();
$category = $article->getCategory(); $content = $article->getContent();
$author = $article->getAuthor(); $category = $article->getCategory();
$tags = $article->getTags(); $author = $article->getAuthor();
$tags = $article->getTags();
}else{
$_SESSION["message"] = "article_not_found";
echo "article_not_found";
}
} catch (Exception $e){ } catch (Exception $e){
$_SESSION["message"] = "internal_error"; $_SESSION["message"] = "internal_error";
echo "Fehler aufgetreten: " . $e->getMessage(); echo "Fehler aufgetreten: " . $e->getMessage();