hi

plz whats the php command to apply for a block to make it show only on a page with specific tag plz like for instance tag/taxonomy term ps3 or xbox

thx in advance

Comments

silverwing’s picture

<?php
// YOUR CODE TAKES CARE OF LISTING PAGE
$make_block_visible = FALSE;
  $term_id_to_trigger_show_block = 43; // replace '43' your term id.
if ((arg(0) == 'taxonomy') && (arg(1) == 'term') && (arg(2) == $term_id_to_trigger_show_block)) {
    $make_block_visible = TRUE;
  }

// THIS TAKES CARE OF NODES
if (arg(0) == 'node' && arg(1) && is_numeric(arg(1))) {
$node = node_load(arg(1));  
foreach ($node->taxonomy as $term) {
        if ($term->tid == $term_id_to_trigger_show_block) $make_block_visible = TRUE;
}
}

    return $make_block_visible;
?>

it seems to work on my testing site. From http://drupal.org/node/320795

~silverwing

_____________________________________________
MisguidedThoughts

tsf’s picture

hi

thx for yur reply.
i tried it and it works but it doesnt show on the homepage, so plz how can i make it show aswell on the home page and the taxonomy term page only.

thx and sry for not being clear the fisrt time

j4’s picture

Thank you Silverwing. Wonderful code.

Jaya

Matti303’s picture

Cheers for the code :)

IE938492’s picture

Was having trouble with this problem. The Context Module solves most of the issues without PHP.

http://drupal.org/project/context