Hi
I have a twig project with the following index.php
:
<?php
require_once 'vendor/autoload.php';
include 'dist.php';
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader);
$loader->addPath('displays');
$twig->addGlobal('css', $css);
$twig->addGlobal('js', $js);
if (basename($_SERVER['REQUEST_URI']) == '1') {
echo $twig->render('Local History/index.twig');
}
if (basename($_SERVER['REQUEST_URI']) == '2') {
echo $twig->render('Local History/V1 Flying Bomb/page1.twig');
}
?>
Currently I’m using reading the URL to see which page should be rendered as something like href="Local History/V1 Flying Bomb/page1.twig"
does not work.
Is there a proper way to do this in twig?
I tried installing Symfony and following the doc http://symfony.com/doc/current/templating/render_without_controller.html
but I get Fatal error: Uncaught Twig_Error_Syntax: Unknown "render" function
Any ideas?