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
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

catch - January 8, 2008 - 12:56

er, why not node title?

#2

moshe weitzman - January 8, 2008 - 13:16

because the View breaks if the node gets renamed.

#3

catch - January 8, 2008 - 13:57

That's a good reason.

#4

ipwa - July 24, 2008 - 14:50

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

merlinofchaos - July 24, 2008 - 14:54
Status:active» by design

http://drupal.org/node/83415

#6

merlinofchaos - July 24, 2008 - 14:56

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

ipwa - July 24, 2008 - 23:11

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

illuminaut - October 5, 2008 - 17:31

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.

 
 

Drupal is a registered trademark of Dries Buytaert.