All checks were successful
Deploy Feature Branch to Test / deploy (push) Successful in 24s
- Front Controller Pattern mit public/index.php als Einstiegspunkt - Eigenes Routing (App\Core\Router) ohne externes Framework - Controller: HomeController, ImpressumController, DatenschutzController - Views mit gemeinsamem Layout (app/views/layouts/main.php) - PSR-4 Autoloading - Statische Assets nach public/ verschoben - Alte Dateien (index.php, impressum.html, datenschutz.html) geloescht - 301-Redirects fuer alte URLs - PHP 8.5 kompatibel - Apache DocumentRoot auf public/ gesetzt
26 lines
470 B
PHP
26 lines
470 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Core\View;
|
|
|
|
abstract class Controller
|
|
{
|
|
protected View $view;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->view = new View();
|
|
}
|
|
|
|
protected function render(string $view, array $data = [], string $layout = 'main'): void
|
|
{
|
|
foreach ($data as $key => $value) {
|
|
$this->view->assign($key, $value);
|
|
}
|
|
$this->view->render($view, $layout);
|
|
}
|
|
}
|