Including the twig file from a subdirectory

前端 未结 1 2075
Happy的楠姐
Happy的楠姐 2021-02-20 17:19

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:in

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 17:46

    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.

    0 讨论(0)
提交回复
热议问题