Restricting block to specific content type
I needed to configure a block to appear on just a specific content type page. I did this by configuring the block to evaluate the following PHP:
One note, I changed 'page' to 'pagex' since I wanted to not apply this block to regular pages, but wanted to provide it as a argument placeholder.
<?php
$match = FALSE;
$types = array('video' => 1, 'pagxe' => 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 = TRUE;
}
}
return $match;
?>

Comments
Post new comment