I needed to hide a block for a certain node type on a drupal driven website so i found this snippet on drupal.org. I will post it here for my future needs.
Paste this in "Page specific visibility settings" tab on the block you want to hide. Select "Show if the following PHP code returns TRUE (PHP-mode, experts only)." first.
<?php
$match = TRUE;
$types = array('story' => 1);
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if (isset($types[$type])) {
$match = FALSE;
}
}
return $match;
?>
Comments
Thanks, Works a treat
Thanks, Works a treat
The reverse of this in drupal 6 doesn't work.
in drupal 6...
I switched the last "$match = FALSE;" to be "$match=TRUE;"
And I can't get it to work the way I want.
in fact, even with it as FALSE, it shows up on EVERY page.
Any thoughts?
Thanks
Post new comment