Reputation: 12864
I did a symfony migration from version 2.7 to version 3.4
Every thing is ok except one thing. The twig files are not working the error message is :
Unable to find template "::layout.html.twig" (looked into: vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resources/views/Form, vendor\knplabs\knp-menu\src\Knp\Menu/Resources/views) in abcdBundle::layout.html.twig at line 3.
The twig code is :
{% extends "::layout.html.twig" %}
I want to load the layout localised into app/Resources/views/layout.thml.twig
.
I have tried this code too : {% extends "layout.html.twig" %}
without ::
same troubles.
Location files:
app/
Resources/
views/
layout.html.twig // it don't find this twig
src/
ab/
cdBundle/
Ressources/
views/
layout.html.twig // error into this file
Upvotes: 1
Views: 719
Reputation: 1394
If you want to make your project more bulletproof and ready for future migrations to Symfony 4 – consider moving all your Resources
away from app/
directory.
You can find more ie. in here:
http://fabien.potencier.org/symfony4-directory-structure.html
Upvotes: 1
Reputation: 12864
I have updated the config.yml file to add :
twig:
paths:
'%kernel.project_dir%/app/Resources/views': app
This added the "Namespace" @app
in the "Loader Paths" of bin/console debug:twig
Now, when I use {% extends "@app/layout.html.twig" %}
its working fine.
Thank @Cerad for your help, it's very appreciated
Upvotes: 0