Viewfield

Building a node with viewfield cck and need some setup tips? Viewfield provides great setup options, you can set default values and also send any token value to it %nid, %tid etc. But sometimes you will need to make some extra code for passing arguments.

For example you will override your taxonomy view with default taxonomy view, and there display your nodes. As nodes are now displayed through view, you will have to pass your parameters differently. For example through "Provide default argument" where you can use PHP to pass code.

if(is_numeric(arg(1))){
$node=node_load(arg(1));
$argum=taxonomy_get_term_by_name($node->title);
return $argum[0]->tid;
}
else{
return arg(2);
}

So here we pass term value of node if this is a node view, but if its a view view then you will have to get argument from URL, for example tid which comes from "taxonomy/term/%" so that is what you do with return arg(2);