简体   繁体   中英

(Drupal 6 Views) How can I make a view that shows a list of specific nodes (by node id)?

I'd like to manually specify a view to show certain nodes.

I can add a Node id filter (eg display if node id = 50), but I can make a multiple filters becomes they are "AND"'d (eg display if node id = 50 AND node = 51).

I'd prefer to not have to use taxonomy or whatever, as Im not currently using this. It would be easier to just manually code the view output if thats the case.

What Googletorp says, but there is one more option: You can add an argument for Node:Nid, choose 'Provide default argument' - 'Fixed entry', enter the node ids separated with commas under "Default argument" and check the "Allow multiple terms per argument." box.

Note that this will leave the option open to smart users to specify other node id's in the url, thus changing the output of the view.

You got some options.

  • If the nodes are in range, fx nids 50, 51, 52, 53 , then you can use between/range option in the filter.
  • If it's random nodes fx nids: 3, 50, 340 , it's a bit more difficult, as the views UI doesn't allow OR queries. You can either, use the views OR module Note it's still in dev version or you can create the query yourself with hook_views_query_alter

You can use Views 3 (currently in alpha3 and quite stable). It supports OR out of the box.

But are you dynamically passing the Node Id's via an argument? If not then why don't you consider using Nodequeue module? It will allow you to precisely specify what nodes should be shown.

Nodequeue works well in Views 2 and Views 3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM