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
是的,就是這樣。我查看過那個文件,但現有的代碼與示例有所不同,所以它將我拋棄了。 – Drew
我可以看看你的routing.yml嗎? – scoolnico