Drupal 加入分类术语

发布于 2024-08-20 09:38:33 字数 347 浏览 6 评论 0原文

我有一个像这样的 Drupal 设置:

  • 内容类型:公寓
  • 词汇:区域,可以与公寓一起使用。
  • 内容类型:用户个人资料,带有区域内容分类字段,以便用户可以选择他们感兴趣的区域。

我想要一个显示与其所在区域的公寓匹配的所有用户个人资料的视图。换句话说,“用户配置文件<->区域<->公寓”加入。我已经研究视图界面有一段时间了,但我不清楚如何设置关系来实现这一点。有人可以给我提示吗?

如果用视图无法轻松解决这个问题,那么有什么好的方法呢?感谢您的帮助。

I have a Drupal setup like this:

  • Content type: Apartments
  • Vocabulary: Areas, that can be used with Apartments.
  • Content type: User profile, with a Content Taxonomy Field for Areas so users can select what areas they are interested in.

I would like a view that shows all the user profiles that matches the apartments in their area. A "User profile <-> Areas <-> Apartments" join in other words. I've been mucking around with the views interface for a while but it's not clear to me how the relations can be setup to achieve this. Can someone give me a hint?

In case this cannot be easily solved with views, what is a good way of doing it otherwise? Thanks for your help.

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

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

发布评论

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

评论(2

栖竹 2024-08-27 09:38:33

根据我的经验,我发现视图不能很好地进行分类。通常很难得到你想要的东西,有时你还会为重复的东西而苦苦挣扎。我经常发现自己使用视图陷入了死胡同。

在这种情况下,我可能会在自定义模块中执行此操作。你不需要做太多事情。您应该能够进行一个简单的查询,获取与用户配置文件具有相同 tid 的所有公寓节点。那么这只是你想要提取什么信息的问题。您应该避免使用node_load(),因为它会大大减慢页面速度。

In my experience I've found that views doesn't do taxonomy very well. It's often quite hard to get what you want and then you sometime strugle with duplicates. Often I've found myself hitting a dead end using views for this.

In this case I would probably do this in a custom module. You don't have to do much. You should be able to make a simple query where you get all apartment nodes that has the same tid as the user profile. Then it's just a matter of what info you want to pull out. You should avoid making node_load() as it'll slow the page down a lot.

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