- cleaned up some code
- added DataLoader - added assetDir - splitted modules and controller namespace
This commit is contained in:
parent
d3d889dc4c
commit
21977588d8
18 changed files with 263 additions and 41 deletions
16
src/Venom/Views/VenomRenderer.php
Normal file → Executable file
16
src/Venom/Views/VenomRenderer.php
Normal file → Executable file
|
|
@ -16,7 +16,6 @@ class VenomRenderer
|
|||
private array $vars = [];
|
||||
private string $baseTemplate = '';
|
||||
private string $templateDir = '';
|
||||
private string $assetsDir = '';
|
||||
|
||||
public function __construct(Venom $venom)
|
||||
{
|
||||
|
|
@ -48,6 +47,13 @@ class VenomRenderer
|
|||
}
|
||||
}
|
||||
|
||||
public function renderTemplate($template): void
|
||||
{
|
||||
// random variable name... to remove it instantly
|
||||
echo $this->includeTemplate($template, '1408138186');
|
||||
unset($this->vars['1408138186']);
|
||||
}
|
||||
|
||||
/**
|
||||
* function will load a template (without extension!) into a variable and return the content
|
||||
* @param $template
|
||||
|
|
@ -78,12 +84,16 @@ class VenomRenderer
|
|||
return $this->vars[$name];
|
||||
}
|
||||
|
||||
public function deleteVar($name)
|
||||
{
|
||||
unset($this->vars[$name]);
|
||||
}
|
||||
|
||||
public function init(?RenderController $controller): void
|
||||
{
|
||||
$this->controller = $controller;
|
||||
$data = Config::getInstance()->getRenderer();
|
||||
$this->baseTemplate = $data->baseFile . '.php' ?? 'base.php';
|
||||
$this->templateDir = __DIR__ . '/../../../tpl/' . $data->theme . '/';
|
||||
$this->assetsDir = __DIR__ . '/../../../public/theme/' . $data->theme . '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue