I use Twig and extends only by the layout and fill the blocks. Before i checked it in the git everything works fine. Now after check all nothing works...
Here is the implementation in my Bootstrap:
$this->di->set('view', function () use ($config) {
require SYSTEM_PATH . DS . 'vendor' . DS . 'twig' . DS . 'twig' . DS . 'lib' . DS . 'Twig' . DS . 'Autoloader.php';
$view = new View();
$view->setViewsDir(SYSTEM_PATH_SRC_FRONT . DS . 'Resources' . DS . 'views');
$view->registerEngines(
[
'.html.twig' => function ($view, $di) {
\Twig_Autoloader::register();
$options = [
'cache' => IS_DEVELOPMENT ? false : realpath(SYSTEM_PATH_VAR_CACHE . DS . 'twig') . DS,
];
$functions = [
new \Twig_SimpleFunction('path',
function ($routeName, array $routeParameters = []) use ($di) {
$router = $di->get('router');
/* @var $router Router */
$routerParams = $router->getParams();
$urlParams = array_merge([
'for' => $routeName,
'language' => $routerParams['language']
], $routeParameters);
return $di->get('url')->get($urlParams);
}),
];
$twig = new View\Engine\Twig($view, $di, $options, $functions);
$twig->getTwig()->addFilter(new \Twig_SimpleFilter('trans',
function ($key, array $values = []) use ($di) {
return $di->get('translator')->query($key, $values);
}));
$twig->getTwig()->addExtension(new FilterDumpExtension($di));
foreach ($this->getTwigExtensions() as $extension) {
$twig->getTwig()->addExtension($extension);
}
return $twig;
}
]
);
return $view;
});
This code already works for it. The templates are named like i registrered the engine: "index.html.twig". But now, how i'm said after the checkout, the application doesn't work anymore.