Created
December 11, 2012 17:29
-
-
Save bobdenotter/4260478 to your computer and use it in GitHub Desktop.
Bare bones example of broken {{ render() }}
This file contains 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
{ | |
"require": { | |
"silex/silex": "1.0.*@dev", | |
"twig/twig": ">=1.8,<2.0-dev", | |
"symfony/twig-bridge": "2.1.*" | |
}, | |
"minimum-stability": "dev" | |
} |
This file contains 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 | |
require_once __DIR__.'/vendor/autoload.php'; | |
$app = new Silex\Application(); | |
$app['debug'] = true; | |
$app->register(new Silex\Provider\TwigServiceProvider(), array( | |
'twig.path' => __DIR__.'/views' | |
)); | |
$app->match('/', function () use ($app) { | |
return $app['twig']->render('index.twig'); | |
}); | |
$app->match('/sub', function () use ($app) { | |
// This next line is the culprit.. | |
$app['twig']->addGlobal('foo', 'bar'); | |
return "This is the sub"; | |
}); | |
$app->run(); |
This file contains 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
<h1>Silex / Twig render demo</h1> | |
{{ render('/sub') }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment