CCK 模板中的自定义评论表单
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
评论在多个地方进行处理。最重要的可能是节点模板文件和 template.php 文件。因此,如果某个节点的注释未显示(但其他节点类型的注释则显示),则可能出现问题的地方数量有限。
我查看了该模块的代码,它似乎不是导致此问题的原因。但是,当您认为看到时,您可能并未看到实际的节点。这是最有可能的原因。您正在查看由模块生成的页面,而不是查看节点本身。这可以解释问题,因为您只需看到模块定义的内容。解决此问题的方法是将节点注释包含在所使用的模板文件中。我看到该模块实现了很多模板文件,因此您可以获取需要更改的模板文件的副本,并在其中添加一些代码来打印注释。您可能需要在预处理函数(在 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.
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.