开发者

Is a drupal View useful for this use case

开发者 https://www.devze.com 2023-01-09 23:41 出处:网络
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).

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?开发者_开发百科


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:

  • Favorite Nodes module
  • Favorites module


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消