node.tpl.php 中的 $content 变量 (Drupal 5)

发布于 2024-08-07 09:10:02 字数 184 浏览 4 评论 0原文

node.tpl.php 中的 print $content 语句导致我的整个布局中断,可能是由于 DIV 嵌套不正确。

我想检查并修复这个问题,但我无法弄清楚 node.tpl.php 文件中 $content 变量的来源是什么/在哪里。

我将不胜感激任何帮助。谢谢。

The print $content statement in node.tpl.php is causing my whole layout to break probably due to incorrect nesting of DIVs.

I want to check and fix that but I can't figure out what/where is the source of the $content variable in node.tpl.php file.

I'd appreciate any help. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

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

评论(5

淑女气质 2024-08-14 09:10:02

$content 是保存所有内容的变量。因此很难通过嵌套的 div 来确定错误的确切位置。

但是,问题很可能出在位于主题或自定义构建模块中的自定义主题函数中。 do 中的模块通常不存在此类错误,因此希望您能够在有限的可能性下快速找到问题。

另一个问题可能出在用于生成某些内容的模板中,同样,您应该只查看主题中的定制模板。

$content is the variable that holds all the content. So it's difficult to pin point the exact location of the error with the nested divs.

However, the problem is most likely in a custom theme function located in your theme or a custom built module. Modules from d.o is usually free of such bugs, so hopefully you should be able to find the problem pretty quickly with the limited possibilities.

Another problem could be in the templates that's used to generate some of the content, again, you should only look at the custom made ones in your theme.

油焖大侠 2024-08-14 09:10:02

Drupal 节点中的 $content 变量并非来自任何一处。所有启用的模块都可以使用 hook_nodeapihook_view 等 Drupal 挂钩添加、删除和调整 $content 变量。

了解您启用了哪些模块以及导致问题的确切 HTML 可能会帮助人们为您提供更多帮助。按原样,你的问题的答案是“这取决于”。

The $content variable in Drupal nodes doesn't come from any one place. All enabled modules are able to add, remove, and tweak the $content variable, using Drupal hooks like hook_nodeapi and hook_view.

Knowing what modules you have enabled and the exact HTML that's causing trouble may help people help you more. As-is, the answer to your question is "it depends".

金橙橙 2024-08-14 09:10:02

没有一个地方可以成为 $content 的来源,它可以包含几乎任何地方生成的内容。

调试的一种方法是关闭模块,直到问题消失,然后找出该模块中导致问题的原因。

There is no one place which will be the source of $content it can contain generated content from just about anywhere.

A way to debug is to turn off modules until the problem goes away and then work out what in that module is causing the problem.

一桥轻雨一伞开 2024-08-14 09:10:02

$content 是从 hook_view() 返回的内容。

如果许多节点受到影响,听起来可能是导致问题的自定义主题函数。

The $content is what is returned from hook_view()

If many nodes are affected it sounds like it could be a custom theme function that is causing the problems.

南烟 2024-08-14 09:10:02

尝试使用调试器来查看给定时间包含变量的内容。如果我没记错的话 $content 是当前节点生成的 html 内容。

Try to use a debugger to see what contains the variable at a given time. If I remember correctly $content is the generated html content for the current node.

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