Files
webprogrammierung/php/controller/showArticle-controller.php
T

30 lines
871 B
PHP

<?php
session_start();
require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php';
if (isset($_GET["id"])){
try {
$id = $_GET["id"];
$articleManager = ArticleManager::getInstance();
$article = $articleManager->getArticle($id);
if($article != null){
$title = $article->getTitle();
$content = $article->getContent();
$category = $article->getCategory();
$author = $article->getAuthor();
$tags = $article->getTags();
}else{
header("location: ../../index.php?pfad=404");
exit();
}
} catch (Exception $e){
$_SESSION["message"] = "internal_error";
header("location: ../../index.php?pfad=showArticle");
exit();
}
}else{
header("location: ../../index.php?pfad=404");
exit();
}
?>