2015-10-15 65 views
1

我开始学习Symfony和我感到困惑的确切位置放置此页面上显示的例子YAML代码:https://symfony.com/doc/current/cookbook/templating/render_without_controller.html如何呈现一个静态页面没有控制器

具体地,在这段代码直播:

acme_privacy: 
    path: /privacy 
    defaults: 
     _controller: FrameworkBundle:Template:template 
     template: static/privacy.html.twig 

我可以找到一个最接近的东西,当搜索答案是这个职位:Not using templates Symfony 2。但是,它并没有阐明放置该代码的位置。

感谢

编辑:我的应用程序/配置/的routing.yml文件

_wdt: 
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" 
    prefix: /_wdt 

_profiler: 
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" 
    prefix: /_profiler 

_configurator: 
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml" 
    prefix: /_configurator 

_errors: 
    resource: "@TwigBundle/Resources/config/routing/errors.xml" 
    prefix: /_error 

_main: 
    resource: routing.yml 

我已将此添加到文件的末尾,它的工作!

testing_privacy: 
    path: /privacy 
    defaults: 
     _controller: FrameworkBundle:Template:template 
     template: static/privacy.html.twig 

回答

3

大概在app/config/routing.yml

+0

是的,就是这样。我查看过那个文件,但现有的代码与示例有所不同,所以它将我抛弃了。 – Drew

+1

我可以看看你的routing.yml吗? – scoolnico

相关问题