A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://gist.github.com/kylekatarnls/ba13e4361ab14f4ff5d2a5775eb0cc10 below:

Use Pug in a Silex app · GitHub

Created December 12, 2017 15:38

Clone this repository at <script src="https://gist.github.com/kylekatarnls/ba13e4361ab14f4ff5d2a5775eb0cc10.js"></script>

Save kylekatarnls/ba13e4361ab14f4ff5d2a5775eb0cc10 to your computer and use it in GitHub Desktop.

Use Pug in a Silex app

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters <?php // Install Pug with: composer require pug-php/pug $app['view'] = function () { return new Pug(array( 'cache' => './storage/cache', 'paths' => array( // Here you can record differents root directories // containing pug templates. './views', ), )); }; $app->get('/hello/{name}', function ($name) use ($app) { // Supposing you have a template stored in ./views/hello.pug return $app['view']->renderFile('hello', array( 'name' => $name, )); }); // You can call the service more explicitly $app['pug'] and call explicitly // templates files with extensions ->renderFile('hello.pug') // but the benefit of the "view" naming and extension omit is it allow you // to easily switch to an other template engine.

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4