-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.php
More file actions
28 lines (20 loc) · 698 Bytes
/
env.php
File metadata and controls
28 lines (20 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// Composer autoloader
require_once __DIR__ . '/vendor/autoload.php';
// Twig global environment
$rootDir = $rootPath ?? getcwd();
$loader = new Twig\Loader\FilesystemLoader(rootPath: $rootDir);
$loader->addPath('templates/layouts', 'layouts');
$loader->addPath('templates/components', 'components');
$loader->addPath('templates/pages', 'pages');
$loader->addPath('templates/pages-internal', 'pages-internal');
$twig = new Twig\Environment($loader, [
'debug' => true,
'cache' => getenv('TWIG_TEMPLATE_CACHE') ?: $rootPath . '/.cache',
'strict_variables' => true
]);
$twig->addGlobal('page', [
'url' => $_SERVER['REQUEST_URI'],
'dev' => $devMode,
]);
return $twig;