Registering twig to project
This commit is contained in:
17
Core/View.php
Normal file
17
Core/View.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Core;
|
||||
|
||||
class View
|
||||
{
|
||||
private static $twig = null;
|
||||
|
||||
public static function render($template, $args = [])
|
||||
{
|
||||
if (self::$twig === null) {
|
||||
$loader = new \Twig_Loader_Filesystem('App/Views');
|
||||
$twig = new \Twig_Environment($loader);
|
||||
}
|
||||
|
||||
echo $twig->render($template, $args);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user