First basic working version with twig
This commit is contained in:
22
src/renderer.php
Normal file
22
src/renderer.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Ardent\Game;
|
||||
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
class renderer
|
||||
{
|
||||
private Environment $twig;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$loader = new FilesystemLoader('../templates');
|
||||
$this->twig = new Environment($loader);
|
||||
}
|
||||
|
||||
public function render(string $template, array $data = []): string
|
||||
{
|
||||
return $this->twig->render($template, $data);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user