| 1 | <?php |
| 2 | require_once("folderNode.php"); |
| 3 | require_once __DIR__ . '/templateRenderer.php'; |
| 4 | require_once __DIR__ . '/templateCssLinker.php'; |
| 5 | |
| 6 | $renderer = new TemplateRenderer(__DIR__ . DIRECTORY_SEPARATOR . '/templates'); |
| 7 | |
| 8 | if (isset($_GET['path'])) { |
| 9 | $html = $renderer->renderFromJsonFile($_GET['path']); |
| 10 | } else { |
| 11 | $data = loadFolderTree(__DIR__ . DIRECTORY_SEPARATOR . 'data'); |
| 12 | |
| 13 | if ($data) { |
| 14 | // Non-recursive (only proficiencies/*.json): |
| 15 | $onlyHere = $data->jsonNonRecursive(); |
| 16 | |
| 17 | // Recursive (proficiencies/**/*.json): |
| 18 | $allUnder = $data->jsonRecursive(); |
| 19 | } |
| 20 | |
| 21 | try { |
| 22 | $html = $renderer->renderAll($allUnder); |
| 23 | } catch (Throwable $e) { |
| 24 | $html = '<pre class="error">' . htmlspecialchars($e->getMessage()) . '</pre>'; |
| 25 | } |
| 26 | } |
| 27 | ?> |
| 28 | <!DOCTYPE html> |
| 29 | <html lang="en"> |
| 30 | |
| 31 | <head> |
| 32 | <meta charset="UTF-8"> |
| 33 | <title>66 Wiki</title> |
| 34 | <link rel="stylesheet" href="main.css"> |
| 35 | <?php echoTemplateCssLinks(__DIR__ . DIRECTORY_SEPARATOR . 'templates', 'templates'); ?> |
| 36 | </head> |
| 37 | |
| 38 | <body> |
| 39 | |
| 40 | <?= $html ?> |
| 41 | |
| 42 | </body> |
| 43 | |
| 44 | </html> |