用于显示节点注释的节点的 Drupal 视图

发布于 2024-09-26 20:50:47 字数 189 浏览 1 评论 0原文

我遇到了一个 Drupal 问题:我使用 Views 模块根据其作者的用户 ID 来渲染某种节点(实际上它是一个内容配置文件)。我希望视图显示节点的注释,就像在 node/% 中一样。我在视图或任何相关模块中找不到任何选项。我是否走错了方向,应该为此重新组织东西......?

有什么想法吗?如何实现?

问候,

拉奇

I've encountered a Drupal problem: I'm using the Views module for rendering nodes of a kind, based on the user id of it's author (it is a Content Profile actually). I want the view to show the comments for the node, just like in node/%. I could not find any option in views or any relevant module. Am I in the wrong direction and should reorganize stuff for this...?

Any ideas, how can it be done?

Regards,

Laci

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

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

发布评论

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

评论(4

伪心 2024-10-03 20:50:47

使用视图确实不是最好的行动计划。您应该在主题中创建一个节点模板并对其进行自定义。如果需要,您可以在预处理函数中添加一些逻辑。它需要更多的编码,但会让你到达你想要的地方。

Using views is really not the best plan of action. You should instead create a node template in your theme and customize it. If needed you can put some logic in a preprocess function. It requires more coding but will get you where you want.

ゝ偶尔ゞ 2024-10-03 20:50:47

如果使用视图节点显示类型
检查它的设置显示评论
如果您使用视图字段显示类型
使用评论关系并选择您需要的字段并主题化它们

If you use view node display type
Check in it's settings show comments
if you use view fields display type
Use relationship to comments and select fields you need and theme them

温柔戏命师 2024-10-03 20:50:47

我知道这是旧请求,但我只是在解决同样的问题并遇到了这篇文章。我认为分享我的解决方案会有帮助。

我正在使用 Drupal 7、Views 3 和 Display Suite。

  1. 在您看来,选择有问题的显示器。
  2. 在“格式”下,单击“显示”右侧的第一个链接。
  3. 选择“内容”(在我的例子中选择“显示套件”)。
  4. 单击“应用”。
  5. 在下一个屏幕上,您可以选择“显示评论”。选中此框并保存您的视图。

您现在应该看到视图中每个项目下显示的注释。

I know this is old request, but I was just struggling with the same issue and came across this post. I thought it'd be helpful to share my solution.

I'm using Drupal 7, with Views 3 and Display Suite.

  1. In your view, choose the display in question.
  2. Under Format, click the first link to the right of 'Show'.
  3. Choose 'Content' (or 'Display Suite' in my case).
  4. Click 'Apply'.
  5. On the next screen, you'll have the option to 'Display comments'. Check this box and save your view.

You should now see the comments displayed under each item in the view.

幽梦紫曦~ 2024-10-03 20:50:47

您可以创建第二个视图(使用 URL,例如 /comments/%,其中占位符将是节点 ID,而不是评论 ID),列出给定节点的评论,并使用上下文过滤器仅根据 URL 中的 NID 显示它们。

然后,将该视图添加到已有的单节点视图的页脚(作为“视图区域”)。

布局需要一些调整(内联字段等),但基本结构应该可以工作。

You could create a second view (with URL e.g. /comments/% where the placeholder will be the node ID, and not the comment ID) that lists comments for a given node, with a contextual filter to only show them based on the NID in the URL.

Then, add that view to the footer (as a 'view area') of the single-node view you've already got.

There's some tweaking required for layout (inline fields etc.) but the basic structure should work.

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