This commit is contained in:
2026-03-02 01:45:57 +01:00
parent c92f6d7673
commit 3102790842
8 changed files with 317 additions and 85 deletions

28
src/App/functions.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/**
* Lädt ein Template-Partial.
*
* @param string $name Dateiname ohne .php
* @param string $folder Unterordner in /public/partials/
* @param array $data Daten, die im Template verfügbar sein sollen
*/
function tpl(string $name, string $folder = 'landing', array $data = []): void
{
$path = __DIR__ . '/../../public/partials/' . $folder . '/' . $name . '.php';
if (file_exists($path)) {
extract($data);
require $path;
} else {
echo "<!-- Template not found: {$folder}/{$name} -->";
}
}
/**
* HTML Escaping Helper.
*/
function e(?string $string): string
{
return htmlspecialchars($string ?? '', ENT_QUOTES, 'UTF-8');
}