From 3862b68d9f97a6b7da04c31e236031e3381c99f4 Mon Sep 17 00:00:00 2001 From: Felix Ivo Date: Fri, 13 Jun 2025 08:06:38 +0200 Subject: [PATCH] added notes page --- Controller/NotesController.php | 27 +++++++++++++++++++++++++++ Model/NotesModel.php | 29 +++++++++++++++++++++++++++++ Views/Notes/showNotes.phtml | 17 +++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 Controller/NotesController.php create mode 100644 Model/NotesModel.php create mode 100644 Views/Notes/showNotes.phtml diff --git a/Controller/NotesController.php b/Controller/NotesController.php new file mode 100644 index 0000000..cdb8a6c --- /dev/null +++ b/Controller/NotesController.php @@ -0,0 +1,27 @@ +notesModel = new NotesModel(); + $this->view = $view; + } + + public function showNotes() + { + $this->view->setVars([ + "notes" => $this->notesModel->selectNotes() + ]); + + } + +} \ No newline at end of file diff --git a/Model/NotesModel.php b/Model/NotesModel.php new file mode 100644 index 0000000..35253c8 --- /dev/null +++ b/Model/NotesModel.php @@ -0,0 +1,29 @@ +linkDB(); + + try { + $res = $pdo->query($sql); + } catch (\PDOException $e) { + new \ppa\Library\ErrorMsg("Ihre Anfrage konnte nicht verarbeitet werden", $e); + die; + } + + return $res->fetchAll(\PDO::FETCH_ASSOC); + } +} \ No newline at end of file diff --git a/Views/Notes/showNotes.phtml b/Views/Notes/showNotes.phtml new file mode 100644 index 0000000..a152acf --- /dev/null +++ b/Views/Notes/showNotes.phtml @@ -0,0 +1,17 @@ + + +

Notes

+ +
+'; + echo '

' . $n["title"] . '

' + . '

' . $n["content"] . '

'; + echo '
'; + } +?> + + + \ No newline at end of file