Drupal 搜索模块直接链接到评论

发布于 2024-07-23 02:52:46 字数 319 浏览 4 评论 0原文

在我的 drupal 搜索结果页面上,除了帖子本身之外,还直接链接到帖子的评论。 查看 search.module 文件,相关代码似乎是。

$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';

问题是我无法弄清楚 $item['link'] 到底来自哪里,或者如何获取其中评论的链接变量。 您能提供的任何帮助都会很棒。

On my drupal search results page link directly to the comments of the post, in addition to just the post itself. Looking at the search.module file the relevant code seems to be.

$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';

The issue is I can't figure out where on earth $item['link'] is coming from, or how to get the link variable for the comments in there. Any help you could provide would be great.

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

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

发布评论

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

评论(1

情域 2024-07-30 02:52:46

除了直接链接到节点本身之外,您还想链接到评论吗? 这并不难...

对于同一页面,您需要将输出更改为以下内容:

$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt><dd><a href="'. check_url($item['link']) .'#comments">'. check_plain($item['title']) .'</a></dd>;

当然,您需要稍微调整一下主题。

You want to link to the comments in addition to linking directly to the node itself? That's not so hard...

For the same page you need to change the output to something like:

$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt><dd><a href="'. check_url($item['link']) .'#comments">'. check_plain($item['title']) .'</a></dd>;

Of course, you'll want to mess around with the theming a little.

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