yce*_*uto 16
对于所有Symfony版本,资源路径是%kernel.root_dir%/Resources/.由于新的4.0结构放Kernel.php成src/目录,那么它是:
# local resources directory
src/Resources/
# still works this path for local templates
src/Resources/views/
# override resources for third-party bundles
src/Resources/AcmeDemoBundle/views/ # legacy convention to override templates
src/Resources/AcmeDemoBundle/translations/ # for override both translations and validations files
src/Resources/AcmeDemoBundle/... # etc.
Run Code Online (Sandbox Code Playgroud)
Twig模板:只需遵循惯例:
templates/bundles/AcmeDemoBundle/path/to/template.html.twig
Run Code Online (Sandbox Code Playgroud)
如果要升级到Symfony 3.4和4.0并且要使用以前的模板约定,请配置自己的Twig路径:
Run Code Online (Sandbox Code Playgroud)# app/config/config.yml (3.3) twig: paths: # Default templates directory, since 3.4+ templates: ~ # Directory convention to override bundle templates, since 3.4+ # make sure to know the actual Twig namespace for each bundle. # e.g. AcmeDemoBundle -> AcmeDemo: templates/bundles/AcmeDemoBundle: AcmeDemo
翻译:与templates/您translations/在项目根目录中的目录类似(默认情况下):
translations/bundles/AcmeDemoBundle/messages.en.yml
Run Code Online (Sandbox Code Playgroud)
注意:/bundles/AcmeDemoBundle/子目录不是必需的,因为转换与bundle无关,而与域有关.这意味着只要它在正确的域中,您就可以覆盖翻译.
| 归档时间: |
|
| 查看次数: |
1439 次 |
| 最近记录: |