Symfony2 - 覆盖模板包 [英] Symfony2 - override template bundle

查看:43
本文介绍了Symfony2 - 覆盖模板包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想覆盖默认的 SonataAdmin 模板.

I want to override the default SonataAdmin Template.

我在 Namespace/bundle/resources/views 中创建了一个 standard_layout.html.twig(相同的结构,相同的文件名,相同的内容)

I create a standard_layout.html.twig in my Namespace/bundle/resources/views (same structur, same file name, same content)

我在目标模板中复制了源模板的所有内容,我只是编辑了目标的某些部分....什么也没有

I copied all the content of the source template in my target template, i just edit some part of the target off course....and nothing

感谢您的帮助再见

推荐答案

你有捆绑继承的解决方案 http://symfony.com/doc/current/cookbook/bundles/inheritance.html 不仅允许覆盖模板,还允许覆盖方法.

You have the solution of bundle heritance http://symfony.com/doc/current/cookbook/bundles/inheritance.html which allows, not only override templates but methods too.

或者你有 http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates 只关注模板.

Or you have http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates which focusing only on templates.

有了这个,你可以尝试创建:

With this last, you can try to create :

app/Resources/SonataAdminBundle/views/CRUD/base_show_field.html.twig

这篇关于Symfony2 - 覆盖模板包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆