header("Access-Control-Allow-Origin: *");
-\Twig_Autoloader::register();
-
-$loader = new \Twig_Loader_Filesystem(__DIR__ . '/../data/templates/');
-$twig = new \Twig_Environment(
+$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../data/templates/');
+$twig = new \Twig\Environment(
$loader,
array(
//'cache' => '/path/to/compilation_cache',
function render($tplname, $vars = array(), $return = false)
{
- $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
+ $template = $GLOBALS['twig']->load($tplname . '.htm');
if ($return) {
return $template->render($vars);
echo $template->render($vars);
}
}
-?>
\ No newline at end of file
+
+/**
+ * No trailing slash
+ */
+function getBaseUrl()
+{
+ return $_SERVER['REQUEST_SCHEME']
+ . '://' . $_SERVER['HTTP_HOST'];
+}
+?>