Reputation: 195
When trying to render a Twig Template within a Symfony 4 project I'm getting an error. I don't know which is the problem. This is the code generating the error:
return $this->render('templates/imagenes/index.html.twig');
And this is the error I'm getting:
LogicException You can not use the "render" method if the Templating Component or the Twig Bundle are not available.
Should I install Twig via composer apart Symfony itself?
Upvotes: 4
Views: 6084
Reputation: 1
A guy named Simon Wald-burger mentioned in the lesson's comments that installing "debug" fixed the issue (it fixed it for me). The instruction was in the next lesson.
composer require debug --dev
iiirxs is also correct, to output dump in twig file, do
{{ dump(variable) }}
Upvotes: 0
Reputation: 193
return $this->render('templates/imagenes/index.html.twig');
Create the project using this command
composer create-project symfony/skeleton-website project_name
No need to install twig,etc
Upvotes: 0
Reputation: 463
and you should not need the templates directory, so just 'imagenes/index.html.twig'
Upvotes: 1