Posted by andersin88 on November 12, 2012 at 3:36am
How to show specific block in node that under taxonomy/term/6 ?
Page specific visibility settings
taxonomy/term/6* //this for showing block on website.com/taxonomy/term/6
what path should i add in page specific visibility settings to show block on all node that under taxonomy/term/6
is that need add php snippet?
http://drupal.org/node/115419
Comments
taxonomy/term/6 only covers
taxonomy/term/6 only covers that page, not node pages where the node has term id 6.
The snippet is for controlling visibility based on node type and/or id.
I would suggest using the context module, with it you can set up a reaction on taxonomy term(s) and have it show select blocks in the region(s) of your choice.
Yes you can use the php
Yes you can use the php snippet to filter the visibility. Just you will need to add the following code
<?phpif(arg(0) == 'node' && is_numeric(arg(1))){
$nid = arg(1);
$node = node_load(array('nid'=>$nid));
$terms = taxonomy_node_get_terms($node);
foreach($terms as $term){
if($term->tid== 6) //6 is the term id I am passing hardcoded
return true;
}
return false;
}
else
return false;
?>
Hth,
Sadashiv.
thank, it work.
thank, it work.
Get this working in Drupal 7?
Do you know how to get this working in Drupal 7?
I'm trying to display a block based on a taxonomy term. I can get it working in Drupal 6 but not 7.
I think<?phpif(arg(0) ==
I think
<?php
if(arg(0) == 'node' && is_numeric(arg(1))){
$nid = arg(1);
$node = node_load(array('nid'=>$nid));
$terms = field_view_field('node', $node, 'field_tags', array('default'));
$terms = $terms['#object']->field_tags['und'];
foreach($terms as $term){
if($term['taxonomy_term']->tid== 6) //6 is the term id I am passing hardcoded
return TRUE;
}
return FALSE;
}
else {
return FALSE;
}
?>
should work, not tried.