CCK 模板中的自定义评论表单

发布于 2024-08-11 03:55:00 字数 441 浏览 7 评论 0原文

Pre-abmle:我正在使用 MakeMeeting 模块来创建/显示会议民意调查。 该模块有自己的内容类型,我无法在该模块上显示评论 屏幕(无论我选择在该节点类型的“评论设置”中还是在同一页面上显示评论)。 MakeMeeting 模块有它自己的主题功能,但据我所知,它们可能没有罪,因为 Drupal 必须向模块生成的任何数据添加注释。

这就带来了两个相关的问题:

1)如何使用自定义代码让评论功能显示在自定义 CKK 节点上? 最有可能的是这段代码应该添加到node-typename.tpl.php

2)我如何调试为什么注释不显示,我应该在哪里检查(函数调用,变量名称等)。

谢谢!

Pre-abmle: I am using MakeMeeting module to create/display meeting polls.
This module has its own Content Type and I can't get comments to show on the
screen (whether I choose to show comments or on same page or not in Comment Settings for this node type). The MakeMeeting module has it's own theme functions, but perhaps they're not guilty since Drupal must add comments to whichever data is produces by a module, as far as I know.

This brings up two related questions:

1) How can one use custom code to get comment functionality show up on custom CKK node?
Most probably be this code should be added to node-typename.tpl.php

2) How can I debug why comments are not displayed, where should I check (function calls, variable names etc).

Thanks!

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

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

发布评论

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

评论(1

鱼忆七猫命九 2024-08-18 03:55:00

评论在多个地方进行处理。最重要的可能是节点模板文件和 template.php 文件。因此,如果某个节点的注释未显示(但其他节点类型的注释则显示),则可能出现问题的地方数量有限。

  1. 最重要的地方可能是显示节点时使用的模板文件。但是,如果这与您站点中的其他节点类型相同,并且注释显示在那里,那么这不会是问题
  2. 之后,我将转到您的 template.php 文件,并查看 preprocess_node 函数。在这里,主题可以按照自己的逻辑来确定是否应该显示评论。
  3. 第三种选择是,如果您的主题已经实现了自己的用于评论的主题功能。我认为使用的是 theme_comment_view()

我查看了该模块的代码,它似乎不是导致此问题的原因。但是,当您认为看到时,您可能并未看到实际的节点。这是最有可能的原因。您正在查看由模块生成的页面,而不是查看节点本身。这可以解释问题,因为您只需看到模块定义的内容。解决此问题的方法是将节点注释包含在所使用的模板文件中。我看到该模块实现了很多模板文件,因此您可以获取需要更改的模板文件的副本,并在其中添加一些代码来打印注释。您可能需要在预处理函数(在 template.php 中)中使用一些代码,以获得评论的实际主题版本,您可以在模板文件中打印该版本。

无论如何,这些只是很多建议或猜测,但我不知道这些是否有帮助。但这些是我要开始关注的事情。

Comments are handled several places. Most importantly is probably the node template file, and the template.php file. So if comments for a node is not showing up (but is for other node types), there is a limited amount on places where things can go wrong.

  1. The most important place to go look would probably be the template file that is used when the node is displayed. But if this is the same as for the other node types in your site, and the comments are displayed there, this cannot be a problem
  2. After that, I would go to your template.php file, and look at preprocess_node function. Here the theme can do it's own logic to determine if the comments should be presented or not.
  3. A third option, could be if your theme has implemented it's own theme function of theme function used for the comments. I think it's theme_comment_view() that's used.

I looked through the code for the module, and it doesn't seem like it can be the cause of this problem. However, you might not be viewing an actual node when you think you do. This is the most likely reason. That you are viewing a page that is generated by the module instead of viewing the node itself. This could explain the problem, as you just see what the module has defined. A solution to this, would be to include the node comments in the template file used. I saw that the module implements a lot of template files, so you can take a copy of the one you need to alter, and add in some code in there, that prints the comments. You might need to use some code in a preprocess function (in template.php), to get the actual themed version of the comments, that you can print in your template file.

Anyways, these are just a lot of suggestions, or guesses, but I can't know if any of this will help. But these are the things where I would start to look.

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