Symfony2 commandline generation of twig templates under global folder(Symfony2命令行生成全局文件夹下的树枝模板)
问题描述
我使用的是 Symfony2.8,每当我使用命令行生成 控制器 和 twig 模板 时,模板都是在
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
我想遵循 symfony 文档建议的最佳做法 并将其放在
I want to follow the best practices suggested by symfony docs and have it inside of the
app/Resources/views/home/home.html.twig
我可以剪切并粘贴树枝文件,然后在必要时更改 {% extends %}
,但这样我头上的头发就会减少,因为我会把它拔出来.
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.
那么我在提示中输入什么,以便它像往常一样在 MyBundle
中生成控制器,但树枝文件将位于全局 app/Resources/views
下文件夹
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
谢谢!
新的扩展问题
推荐答案
在玩了一下模板生成的路径后,我成功地将树枝文件放在了 app/Resources/views/文件夹中.
After playing a little with the path for template generation i succeeded in placing the twig file inside the app/Resources/views/ folder.
假设你有一个 symfony2 应用程序的标准架构:当生成器要求指定模板名称时,您可以为模板编写以下路径
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
这篇关于Symfony2命令行生成全局文件夹下的树枝模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Symfony2命令行生成全局文件夹下的树枝模板
- PHP Count 布尔数组中真值的数量 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Laravel 仓库 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01