Symfony2 commandline generation of twig templates under global folder

霸气de小男生 提交于 2019-12-30 18:55:25

问题


I'm using Symfony2.8 and when ever I use the command line for generating controllers and twig templates the templates are created under

MyBundle/Resources/views/home/home.html.twig

I want to follow the best practices suggested by symfony docs and have it inside of the

app/Resources/views/home/home.html.twig

I could just cut and paste the twig file and then change the {% extends %} if necessary, but then I would have lesser hair on my head because I would be pulling it out.

So what do I type in the prompt so that it generates the controller in the MyBundle as usual BUT the twig files would be under the global app/Resources/views folder

Thanks!

Edit: new extended question


回答1:


After playing a little with the path for template generation i succeeded in placing the twig file inside the app/Resources/views/ folder.

Assuming that you have the standard architecture of a symfony2 app: You could write the following path for the template when generator asks to specify the Templatename

Templatename (optional) [AppBundle:Post:get.html.twig]: ::../../../../app/Resources/views/Post/get.html.twig


来源:https://stackoverflow.com/questions/38265685/symfony2-commandline-generation-of-twig-templates-under-global-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!