drupal View 对于这个用例有用吗
我有一个想要呈现给用户的节点列表。然后用户选择 3 个,我需要记住该决定,以便稍后将它们呈现在较小的列表中(您的选择列表)。
为了呈现完整的节点列表,我将仅使用视图来获取所有已发布的节点。
问题是我如何存储这 3 个选择,以便我可以将它们拉到“您的选择列表”中?我应该使用什么结构来保存它们?创建称为列表的内容类型或使用视图。不确定,还是这个用例有更符合逻辑的东西?
I have a list of nodes that I want to present to the user. The user then picks 3 and I need to remember that decision so I can present them in a smaller list later (your choices list).
To present the full list of nodes, I will just use views to get all published nodes.
The question is how do I store those 3 choices so I can pull them in the "your choices list"? What structure should I use to save them? create a content type called list or use views. Not sure, or there's something more logical for this use case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您肯定想仔细看看Flag 模块。它提供了一个灵活的系统来“标记”(或标记)节点、用户和评论,以及良好的视图集成。
使用此功能,您可以创建一个“收藏夹”标志,将其设置为“每个用户”,并且您的用户可以使用它来标记节点。通过视图集成,您可以通过多种方式创建对这些标志进行过滤的自定义视图,从而可以轻松创建显示这些收藏夹的页面和块。
我不确定它是否支持限制,例如每个用户开箱即用三个标志,但它还附带一个 API,因此您应该能够影响类似的事情(但不能保证;)
您可能还想检查以下内容,但我没有使用它们的经验,所以不知道它们是否好和/或适合您的账单:
You most definitely want to take a closer look at the Flag module. It provides a flexible system for 'flagging' (or marking) nodes, users and comments, along with good views integration.
Using this, you could create a flag 'favorite', set it as 'per user' and your users can use this to mark nodes. With the views integration, you can create custom views filtering on those flags in many ways, thus you can easily create pages and blocks that display those favorites.
I'm not sure if it supports a limitation to e.g. three flags per user out of the box, but it also comes with an API so you should be able to influence things like that (no guarantee, though ;)
You might also want to check the following, but I have no experience using them, so no idea if they are good and/or fit your bill:
一个简单而有效的其他方法是在视图中添加一个 php 字段。在 php 中,将节点 ID 保存到 $_SESSION 变量中,如果需要更长的生存时间,则保存到数据库中。
您可以利用传递给视图的强大参数,使其使用 nids 显示节点。
我们经常在网上商店中使用它来记住上次查看的产品等。
a simple and effective other approach is to add a php field in the view. In the php save the node id into the $_SESSION variable or to the database if you need longer live times.
You can make use of the powerfull arguments passing to views to make it show the nodes using the nids.
We often use it in webstores to remember the lastviewed products and such.