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:Welcome is just a logical controller name, the : doesn't mean a /. This logical name refers to the @AcmeDemoBundle/Resources/views/Welcome directory where @AcmeDemoBundle is a logical bundle name which become something like src/Acme/DemoBundle.
If you want to add another directory to the name, just place it after the logical name as you normally do:
AcmeDemoBundle:Welcome:User/index.html.twig
This refers to the src/Acme/DemoBundle/Resources/views/Welcome/User/index.html.twig file.
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