Skip to content

Instantly share code, notes, and snippets.

@berkus
Last active December 3, 2015 23:31
Show Gist options
  • Save berkus/f54347a4a1fd74e9e162 to your computer and use it in GitHub Desktop.
Save berkus/f54347a4a1fd74e9e162 to your computer and use it in GitHub Desktop.
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