I would like to include a template in my view but it doesn't work, I have this error :
Unable to find template "::StyleBlock/light-pattern.html.twig" in ::base.html.twig at line 46.
My code :
{% for zone in content.blocks %}
{% set path = '::StyleBlock/' ~ zone.styles %}
{% include path %}
{% endfor %}
In the details i have this message :
InvalidArgumentException: The file "views/StyleBlock/light-pattern.html.twig" does not exist (in: /var/www/gathena/app/Resources).
But the path is correct, i don't understand.
I use Symfony 2.3 and I have the good permission on my directory
You have given wrong path, it should be:
{% for zone in content.blocks %}
{% set path = 'CmsCmsBundle:StyleBlock:' ~ zone.styles %}
{% include path %}
{% endfor %}
as for path src/Cms/CmsBundle/Resources/views/StyleBlock/
The first parameter is your bundle, second is the controller in this case StyleBlock
, so your views are in your bundle in Resources/views/StyleBlock
directory, last parameter is the template name which is defined by your loop variable in this case. It should only be your template name, without any absolute paths. All parameters are seperated by :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With