Views is one of the best module of Drupal. It provide a way to map the data in the mysql database to the web interface. You can do that even without writing any SQL query, just some clicks. I do not want to cover all the aspet of Views, but only to show how to restrict the Veiws result based on Arguments.

Arguments are parts of URL, may be a node id in /node/xxxx, or user id in /user/xxxx. Views provide some build-in arguments: See Views arguments. You can restrict the views by Node type, User ID, Term ID, etc. But these build-in features can not meet all of our requirement.

So we can use PHP Code Validator.

For example, I want to show the view only in the node where a CCK field eqs 1. And only show in the content type blog.

$nid = $argument;
$node = node_load($nid);
return ($node->type == ‘blog’ && $node->field_Myfield_type[0][‘value’] == 1);

Put the php code block in the views argument, then you will find the result.