Community Documentation

How to select multiple Nids in a view

Last updated February 29, 2012. Created by no_longer_active_13 on January 20, 2011.
Edited by wmostrey, Seighaus, slashrsm. Log in to edit this page.

We assume that you have a properly configured view at this point. You should have a page or block display with fields/node to be displayed in it.

  1. In the views administration screen add a new 'argument' using '+'. You will see a configuration screen appear at the bottom of the views screen.
  2. In the 'Groups' jump menu that you now see select 'Node'. A list will appear below the jump menu.
  3. In the list look for 'Node: Nid', and check it.
  4. Press the 'Add' button. You will now get the configuration screen for 'Node: Nid'.
  5. Under 'Action to take if argument is not present' select 'Provide default argument', and leave it set at 'Fixed Entry'.
  6. In the field 'Default argument' add the Nids of the nodes separated by a '+' that you want to show by default. (Important: no space character next to "+")
  7. In 'Validator Options' at 'Validator' choose 'Node'. Now select the node types you want, or leave blank for all nodes.
  8. Check the 'Validate user has access to the node'. This will check if a user has permission to view nodes, that are going to be displayed
  9. For the 'Argument Type' select 'Node IDs separated by , or +'.
  10. Check 'Allow Multiple Terms per Argument' and press 'Update Default Display'.

Preview should now show nodes, that you selected as "default argument". You can now pass arguments to your view, to select custom node IDs. If you provide no argument, default will be used. Save the view when ready.

This is a beta doc page. Please review carefully, and feel free to improve where needed.

Comments

I found an issue

Hi,

I followed step by step and it work, but if you are setting a view where you only want X number of nodes to be display because for example the user can only edit those modules and you make the view a menu tab (user/%/my-view) the UID will be send as the argument never showing the NID's you fix in.

Is there any way to exclude the argument from the URL or some plugin that will let me do the "IN" of MySQL*?

*SELECT * FROM {node} WHERE nid IN (X, Y, Z)

Thank you.

Emil Orol
"In the computer business you’re either a one or a zero and I am determined never to be zero."

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Audience
Designers/themers, Programmers, Site administrators, Site users
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here