Related terms View based on current node (Drupal)
When visiting node/x, how to use this node's taxonomy term's related terms as argument, and then get a related terms View?
Say, node/123 has a vocabular开发者_JS百科y "Country" and its term is Canada. Within the same vocabulary, "Canada" is related term of "USA" and "Mexico". Then I want to get a related terms View that list nodes associated with terms USA and Mexico as well.
talking D7 ..
i would suggest to make a new view, with a block display, where you give the taxonomy-id as contextual-filter. make sure to check the relations options ..
then make a custom block (php) and call it like:
<?php $view = views_get_view('view_name');
$view->set_arguments(array($YOUR_TERM_ID));
$view->set_display('block_display_name');
print $view->preview('block_display_name'); ?>
a views-generated block did not work for me ...
精彩评论