From 1f2be8b8ee2fee5817015966fba68fc7ebad816a Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 11:41:46 +0200 Subject: [PATCH] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 7e2c1b6..d9be3f5 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -3,16 +3,20 @@ session_start(); require_once 'php/model/Article.php'; require_once 'php/model/ArticleManager.php'; -echo "test"; if (isset($_GET["id"])){ try { $articleManager = ArticleManager::getInstance(); $article = $articleManager->getArticle($_GET["id"]); - $title = $article->getTitle(); - $content = $article->getContent(); - $category = $article->getCategory(); - $author = $article->getAuthor(); - $tags = $article->getTags(); + if($article != null){ + $title = $article->getTitle(); + $content = $article->getContent(); + $category = $article->getCategory(); + $author = $article->getAuthor(); + $tags = $article->getTags(); + }else{ + $_SESSION["message"] = "article_not_found"; + echo "article_not_found"; + } } catch (Exception $e){ $_SESSION["message"] = "internal_error"; echo "Fehler aufgetreten: " . $e->getMessage();