Drupal 加入分类术语
我有一个像这样的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看这篇文章: http://thereisamoduleforthat .com/content/using-default-arguments-relate-nodes-their-common-taxonomy-terms。它解释了如何做你想做的事。
Check out this post: http://thereisamoduleforthat.com/content/using-default-arguments-relate-nodes-their-common-taxonomy-terms. It explains how to do what you want.
根据我的经验,我发现视图不能很好地进行分类。通常很难得到你想要的东西,有时你还会为重复的东西而苦苦挣扎。我经常发现自己使用视图陷入了死胡同。
在这种情况下,我可能会在自定义模块中执行此操作。你不需要做太多事情。您应该能够进行一个简单的查询,获取与用户配置文件具有相同 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.