aktuelle.kurse/m133/4_Modulinhalte_und_Uebungen/03-WEB-Architektur/03 MVC-Beispiel/controller/Controller.php

30 lines
514 B
PHP
Raw Normal View History

2022-02-24 09:37:43 +01:00
<?php
include_once("model/Model.php");
class Controller {
public $model;
public function __construct()
{
$this->model = new Model();
}
public function invoke()
{
if (!isset($_GET['book']))
{
// no special book is requested, we'll show a list of all available books
$books = $this->model->getBookList();
include 'view/booklist.php';
}
else
{
// show the requested book
$book = $this->model->getBook($_GET['book']);
include 'view/viewbook.php';
}
}
}
?>