Closed adamgen closed 9 years ago
You might just need to add Twig_Extension
via Composer. See this issue: https://github.com/slimphp/Slim-Views/issues/39.
After adding and installing the extensions via composer I get this server error:
The application could not run because of the following error:
Type: Twig_Error_Syntax Message: The function "dump" does not exist in "dashboard.html" at line 23 File: /Applications/MAMP/htdocs/UserFrosting/userfrosting/vendor/twig/twig/lib/Twig/ExpressionParser.php Line: 572
It's as simple as hack, instead of editing the vendor file (which is a big no no) I have added these line to /userfrosting/initialize.php
:
$twig->addExtension(new Twig_Extension_Debug());
$twig-> enableDebug();
And it works like a charm.
Same on Slim 3, solution:
in /bootstrap/app.php:
$container['view'] = function($container){
$view = new \Slim\Views\Twig(__DIR__ . '/../resources/views', [
'cache' => false,
'debug' => true
]);
$view->addExtension(new Twig_Extension_Debug());
$view->addExtension(new \Slim\Views\TwigExtension(
$container->router,
$container->request->getUri()
));
return $view;
};
@FreeWebber is the Twig_Extension_Debug()
something that we should add to the core
Sprinkle's ServiceProvider
class?
I'm trying to echo an array in twig and I found this documentation on twig's site:
In
/userfrosting/vendor/slim/views/Twig.php
I have edited$parserOptions = array('debug' => true);
And I have added this line$this->parserInstance->addExtension(new Twig_Extension_Debug());
afterand I get an error saying