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命令行生成全局文件夹下的树枝模板


基础教程推荐
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何替换eregi() 2022-01-01