I’ve got a problem – I can’t include a twig file in another twig file when it’s placed in the subdirectory. Example:
I’ve got a file AppUserBundle:Dashboard:index.html.twig (symfony path is src/App/UserBundle/Resorcues/views/Dashboard/index.html.twig and so are the other views’ paths).
In that file I’ve got include for a file Status.html.twig placed in AppUserBundle:Dashboard:User subdirectory. But when trying to include it I’m getting message ‘can’t find template’.
{% include 'AppUserBundle:Dashboard:User:Status.html.twig' %}
When I move the Status.html.twig file to AppUserBundle:Dashboard directory and include it everything works just fine. Can I somehow get to any file like that?
AppUserBundle:Dashboard:Subdir:file
AcmeDemoBundle:Welcomeis just a logical controller name, the:doesn’t mean a/. This logical name refers to the@AcmeDemoBundle/Resources/views/Welcomedirectory where@AcmeDemoBundleis a logical bundle name which become something likesrc/Acme/DemoBundle.If you want to add another directory to the name, just place it after the logical name as you normally do:
This refers to the
src/Acme/DemoBundle/Resources/views/Welcome/User/index.html.twigfile.