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!

Comments

catch’s picture

er, why not node title?

moshe weitzman’s picture

because the View breaks if the node gets renamed.

catch’s picture

That's a good reason.

ipwa’s picture

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.

merlinofchaos’s picture

Status: Active » Closed (works as designed)
merlinofchaos’s picture

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.

ipwa’s picture

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

illuminaut’s picture

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.