25 lines
No EOL
520 B
PHP
25 lines
No EOL
520 B
PHP
<?php
|
|
|
|
namespace Core\Http\View\Engine;
|
|
|
|
use Core\Http\View\Render;
|
|
|
|
class HtmlEngine extends Render
|
|
{
|
|
/**
|
|
* @inheritDoc
|
|
* @throws \Exception
|
|
*/
|
|
public function render(): void
|
|
{
|
|
$basePath = $_SERVER['DOCUMENT_ROOT'];
|
|
$viewsPath = app()->resourcePath('views/' . str_replace('.', '/', $this->view) . '.php');
|
|
|
|
if (!file_exists($viewsPath)) {
|
|
throw new \Exception('View not found');
|
|
}
|
|
|
|
extract($this->data);
|
|
include $viewsPath;
|
|
}
|
|
} |