在指定的content-type下显示指定block的php code

<?php
$match = FALSE;

// block is visible on the content types entered here
$types = array('story' => 1, 'page' => 1);
$url = request_uri();

if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node = node_load(arg(1));
$match = isset($types[$node->type]);
}

// block is invisible on URLs entered here
if (strpos($url, "edit")) {
$match = FALSE;
}

// copy paste these for additional URLs
if (strpos($url, "admin")) {
$match = FALSE;
}

return $match;
?>
*解释:在story和page文章类型下显示block,但在包含:edit和admin的时候不显示该block

关键词: