gist/app/bootstrap.php.d/20-twig.php

15 lines
391 B
PHP
Raw Normal View History

2015-05-05 20:33:05 +02:00
<?php
use Silex\Provider\TwigServiceProvider;
$app->register(new TwigServiceProvider(), array(
'twig.path' => $app['root_path'].'/src/Gist/Resources/views',
));
$app->extend('twig', function ($twig, $app) {
2015-11-23 21:59:50 +01:00
$base = str_replace($app['request']->server->get('SCRIPT_NAME'), '', $app['request']->getBaseUrl());
$twig->addGlobal('web_path', $base.'/');
2015-05-05 20:33:05 +02:00
return $twig;
});