Symfony - 模块模板未使用 view.yml 文件中指定的布局加载
我从以前托管在 Linux 机器上并由其他人开发的站点继承了这些 symfony 源文件。 我正在 Windows XP 计算机上进行开发,并尝试使该站点在本地主机上运行。
我已确保 /apps/frontend/config/view.yml 中有以下设置。 (这是所有网站页面的默认设置。)
has_layout:开
布局:布局
并且所选布局在 /apps/frontend/templates/layout.php 中可用且正确
但是,每当我尝试加载页面时,在页面源中,我可以看到它只加载模块模板代码,而不加载周围的任何东西。
I inherited these symfony source files from a site previously hosted on a linux box, and developed by someone else.
I'm developing on a Windows XP machine and am trying to make this site work on localhost.
I've made sure that in /apps/frontend/config/view.yml the setting below are there. (And this is a default setting for all site pages.)
has_layout: on
layout: layout
And that the selected layout is available and correct in /apps/frontend/templates/layout.php
Yet, whenever I try to load a page, in page source, I can see that it only loads the module template code, without anything around it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能存在多个问题:
到您的视图之一(例如
indexSuccess.php
),它有效吗?模块中的项目view.yml
是否没有覆盖?或者模板是否被语句覆盖?
但我的第一个猜测是最重要的:启用所有日志记录并查看日志。
There could be multiple issues:
<?php decorate_with('layout'); ?>
to one of your views (likeindexSuccess.php
, does it work? Is there no override for the projectview.yml
in the module? Or is the template overriden with a<?php decorate_with(FALSE); ?>
statement?But my first guess is the top one: enable all logging and view your log.
你猜怎么着,这是 config/settings.yml 文件中的语法错误。
我用“真”代替“开”,用“假”代替“关”。我不确定它是否是因为该文件同时包含“on”和“true”,或者它是否只能容忍其中之一,具体取决于 symfony 的版本。
花了 5 天的时间敲击键盘敲击一个没有调试功能的愚蠢文件格式。
我不会再心甘情愿地使用yaml文件。
Guess what, it was a syntax error in a config/settings.yml file.
I've put 'true' instead of 'on' and 'false' instead of 'off'. I'm not sure if it was a because the file contained both 'on' and 'true', or if it can only tolerate one or the other depending on version of symfony.
5 days of banging head into keyboard over a stupid file format that has no debug.
I will not use yaml files willingly again.