Add a nid filter
moshe weitzman - December 4, 2007 - 21:51
| Project: | Views |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | by design |
Jump to:
Description
I wanted to exclude a given nid from a View bug was surprised to find that we don't offer Node: nid as a filter. Doh!

#1
er, why not node title?
#2
because the View breaks if the node gets renamed.
#3
That's a good reason.
#4
What would be awesome is to have a nid filter where you could exclude the current id from the view, that way you can make menus using blocks, and the menu items can have a thumbnail picture, title and description. With that filter the post you are looking at wouldn't show up in the menu.
#5
http://drupal.org/node/83415
#6
BTW Views 2 has a nid filter. I thought Views 1 did too actually, but I guess it doesn't. Can simulate it with an argument + argument PHP code to take care of it, so am not really too concerned about it.
#7
I solved it in my case using a Node:ID Argument with a not equal option and using the following Arcument Code:
if ( ($type=='block') && is_numeric(arg(1)) ){$args[0] = arg(1);
}
return $args;
Thanks for the link and the quick response merlinofchaos :)
#8
But how do you use the nid filter to filter out the current node as opposed to a specific nid? Alternatively, how do you filter out a record based on a given argument? I no longer see the options dropdown for the arguments that lets you choose "not equal" like in Views 1, so I wonder how this is done in Views 2. There's gotta be a way to pass an argument and tell Views to display all records NOT matching that argument, but all the default handlers do it the other way around.