Views Argument with multiple taxonomy terms
R.J. - January 1, 2009 - 21:29
Hi, I have a block view that uses term ID as an argument to display node->typeB whenever node->typeB has a taxonomy term that matches node->typeA (node->typeA creates the URL, node->typeB is displayed in a block). It works fine except when node->typeA has multiple terms associated with it; when this happens, the URL is limited to one tid and the block doesn't display on the other terms. Is there a way around this, other than using the views_multiblock module?
Here's my argument handling code:
<?php
if ($view->build_type == 'block' && arg(0) == 'node' ) {
$node=node_load(arg(1)); // Make $node variables available to block view
$term = taxonomy_node_get_terms_by_vocabulary($node->nid, 5); // Pull array of taxonomy terms associated with node
$args[0] = 5; // Vocabulary ID must be 5
$args[1] = key($term); // Assign Term ID to argument
}
return $args;
?>Thanks.
