Skip to content

Instantly share code, notes, and snippets.

@fab1an
Last active October 1, 2015 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fab1an/4d514f5eeace530fdf27 to your computer and use it in GitHub Desktop.
Save fab1an/4d514f5eeace530fdf27 to your computer and use it in GitHub Desktop.
$app->view = new \Slim\Views\Twig();
$app->view->setTemplatesDirectory(__DIR__."/templates/");
$app->view->parserOptions = ['debug' => $config['debug']];
$app->view->parserExtensions = [new \Slim\Views\TwigExtension()];
$app->get('/(:page)', function ($page = "intro") use ($app, $config) {
try {
$app->render('wrapper.html', [
'page' => $page,
'debugEnabled' => ($config['debug'] ? "true" : "false")
]);
} catch (Exception $e) {
$app->notFound();
}
});
...
<body>
{% include "_#{page}.html" %}
</body>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment