Symfony - 模块模板未使用 view.yml 文件中指定的布局加载

发布于 2024-12-07 13:59:02 字数 341 浏览 1 评论 0原文

我从以前托管在 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技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

亣腦蒛氧 2024-12-14 13:59:02

可能存在多个问题:

  • layout.php 中抛出错误 您是否启用了所有警告/错误并检查了日志文件?
  • 它以某种方式呈现错误的布局当您针对不同环境进行视图设置时,可能会发生这种情况。如果添加 到您的视图之一(例如 indexSuccess.php),它有效吗?模块中的项目 view.yml 是否没有覆盖?或者模板是否被 语句覆盖?

但我的第一个猜测是最重要的:启用所有日志记录并查看日志。

There could be multiple issues:

  • An error is thrown in your layout.php Have you enabled all warnings/errors and checked your log files?
  • It renders the wrong layout somehow This could happen when you have view setups for different environments. If you add <?php decorate_with('layout'); ?> to one of your views (like indexSuccess.php, does it work? Is there no override for the project view.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.

数理化全能战士 2024-12-14 13:59:02

你猜怎么着,这是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文