showArticle.php + showArticle-controller.php Implementation
This commit is contained in:
+3
-3
@@ -5,8 +5,8 @@ require_once 'php/model/ArticleManager.php';
|
||||
require_once 'php/model/LocalArticleManager.php';
|
||||
|
||||
try {
|
||||
//$articleManager = ArticleManager::getInstance();
|
||||
$articleManager = LocalArticleManager::getInstance();
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
//$articleManager = LocalArticleManager::getInstance();
|
||||
// Erstellen von Dummy-Beiträgen:
|
||||
$articleManager->addArticle(
|
||||
"Satz des Pythagoras",
|
||||
@@ -72,7 +72,7 @@ try {
|
||||
<div class="container">
|
||||
<a href="index.php?pfad=informatik" class="category-link">Informatik</a>
|
||||
<div class="article-link">
|
||||
<a href="datenschutzVSdatensicherheit.php"><?php if(isset($dummy3)){echo $dummy3->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
|
||||
<a href="index.php?pfad=showArticle.php&id=<?php echo $dummy3->getId()?>"><?php if(isset($dummy3)){echo $dummy3->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+14
-8
@@ -1,12 +1,18 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!--
|
||||
Seite: Anzeige für Beiträge
|
||||
Funktion: Stellt einen übergebenen Beitrag dar.
|
||||
-->
|
||||
|
||||
<?php
|
||||
include_once __DIR__ . '/../php/controller/showArticle-controller.php';
|
||||
?>
|
||||
<main>
|
||||
|
||||
<h1><?php if (isset($title)) {echo $title;} ?></h1>
|
||||
|
||||
<p>
|
||||
<?php if (isset($content)) {echo $content;} ?>
|
||||
</p>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
@@ -1 +1,20 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once '../model/Article.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
|
||||
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();
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
echo "Fehler aufgetreten: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user