仅当没有数据时才显示在块中

发布于 2024-12-01 12:54:12 字数 200 浏览 0 评论 0原文

在 Drupal 7 中,您可以将页眉和页脚添加到块中,即使生成它们的视图没有结果,这些块也会显示。

当视图没有返回结果时,有什么方法可以使用 PHP 在这些区域之一显示文本吗?用伪代码表达同样的事情:

if view has no results:
  echo "Custom message/code here"

In Drupal 7, you can add headers and footers to blocks that will display even when the view generating them has no results.

Is there any way to use PHP to display text in one of those areas when the view returns no results? The same thing expressed in pseudocode:

if view has no results:
  echo "Custom message/code here"

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

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

发布评论

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

评论(1

一向肩并 2024-12-08 12:54:12

View 内置了这样的“无结果行为”。

您可以在“高级”部分下找到。

View has such "No results behavior" built-in.

You can find than under "advanced" section.

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