Skip to content

Instantly share code, notes, and snippets.

@Stormix
Created July 18, 2017 18:34
Show Gist options
  • Save Stormix/6cf1f12855e7ceef692f7f693cfb8136 to your computer and use it in GitHub Desktop.
Save Stormix/6cf1f12855e7ceef692f7f693cfb8136 to your computer and use it in GitHub Desktop.
<?php
// Template HTML (index.html)
<p>Welcome {{ name }}!</p>
// Rendering
require_once '/path/to/composer/autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('/path/to/templates');
$twig = new Twig_Environment($loader, array(
'cache' => '/path/to/cachefolder',
));
echo $twig->render('index.html', array('name' => 'Stormix'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment