Create a gist now

Instantly share code, notes, and snippets.

@berkus /Jade.php
Last active Dec 3, 2015

What would you like to do?
How to use Talesoft/tale-jade with FlightPHP as a render engine
{
"require": {
"mikecao/flight": "~1.2",
"talesoft/tale-jade": "*"
}
}
<?php
Flight::register('view', 'Tale\Jade\Renderer', [[
'paths' => [__DIR__.'/templates/'], // Where you keep your jade templates
'pretty' => true, // For debug only
'adapterOptions' => [
'path' => __DIR__.'/pages-cache/', // Where to cache generated files, writable by webserver
'lifeTime' => 3600
]
]], function($jade) {
// additional init code here, if needed
});
// Flight::render('list', ["items"=>[1,2,3,4]])
Flight::map('render', function($template, $data) {
echo Flight::view()->render($template, $data);
});
// Flight::display('index')
Flight::map('display', function($template) {
echo Flight::view()->render($template);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment