forked from davidpv/symfony2cheatsheet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
32 lines (23 loc) · 740 Bytes
/
index.php
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
29
30
31
32
<?php
require(__DIR__.'/vendor/autoload.php');
use Symfony\Component\Finder\Finder;
try {
Twig_Autoloader::register();
$twig = new Twig_Environment(new Twig_Loader_Filesystem(__DIR__), [
'cache' => false,
]);
$cheatsheets = $twig->loadTemplate('layout.html.twig');
$sheets = new Finder();
$sheets->files()
->name('*.html.twig')
->in(__DIR__.'/sheets');
$includes = [];
foreach ($sheets as $sheet) {
$includes[] = [$sheet->getBasename('.html.twig'), 'sheets/'.$sheet->getFilename()];
}
echo $cheatsheets->render([
'sheets' => $includes
]);
} catch (\Exception $e) {
echo "An error occurred while building the cheatsheet : ".$e->getMessage();
}