$tid = substr($_SERVER['REQUEST_URI'],12,17);
$term = taxonomy_get_term($tid) ;
$node = node_load(arg(1));
if (arg(0) == 'section' && $term->name == 'Events') {
  return TRUE;
}
else {
  return FALSE ;
}


On Wed, Aug 6, 2008 at 1:09 AM, crozilla <crozilla@gmail.com> wrote:
All,

I kinda know what I'm doing in Drupal, but this trick has baffled me.
This is what I want to have happen:  When the page has the term 221,
block/24 is visible, when the page doesn't have the term, the block is
disabled. Sounds simple, right?

Here is code I found on Drupal that seemed to do what I wanted, but
didn't work for some reason. I don't really know PHP that well, and was
hoping someone could point out the problem.

------------------
|
<?php
 //code snippet for causing block to show based on a node's taxonomy term.
 $make_block_visible = FALSE;
 $term_id_to_trigger_show_block = 221;

 if ((arg(0) == 'node') && is_numeric(arg(1))) {
   $terms = taxonomy_node_get_terms(arg(1));
   foreach($terms as $term) {
     if ($term->tid == $term_id_to_trigger_show_block) {
        $make_block_visible = TRUE;
     }
   }
 }
?>

------------

|Also, is this possible using a CCK text field, instead of a category
term? That would be ideal.

Thanks,

Peter

--
[ Drupal support list | http://lists.drupal.org/ ]