Files
new.rybstock.ru/app/Core/View.php
T
2026-06-03 23:12:10 +03:00

24 lines
476 B
PHP

<?php
declare(strict_types=1);
namespace App\Core;
final class View
{
public static function render(string $template, array $data = []): void
{
$templatePath = base_path('views/' . trim($template, '/') . '.php');
if (!is_file($templatePath)) {
http_response_code(500);
echo 'Template not found';
return;
}
extract($data, EXTR_SKIP);
require base_path('views/layouts/main.php');
}
}