Files
new.rybstock.ru/app/Core/View.php
T
2026-06-04 00:27:17 +03:00

30 lines
712 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);
$title = $title ?? 'Рыбсток';
$metaDescription = $metaDescription ?? '';
$metaKeywords = $metaKeywords ?? '';
$breadcrumbs = $breadcrumbs ?? [];
$showBackButton = $showBackButton ?? true;
require base_path('views/layouts/main.php');
}
}