Initial commit, framework/frontend assets setup
This commit is contained in:
commit
9d9858bb37
32 changed files with 4651 additions and 0 deletions
28
src/View/Render/HtmlRender.php
Normal file
28
src/View/Render/HtmlRender.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Core\View\Render;
|
||||
|
||||
use Core\View\Render;
|
||||
|
||||
class HtmlRender extends Render
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function render(): void
|
||||
{
|
||||
$basePath = $_SERVER['DOCUMENT_ROOT'];
|
||||
$viewsPath = $basePath . '/../resources/views/' . str_replace('.', '/', $this->view) . '.php';
|
||||
|
||||
if (file_exists($viewsPath)) {
|
||||
extract($this->data);
|
||||
|
||||
include $viewsPath;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \Exception('View not found');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue