PHP Drupal仅在节点类型上显示块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP Drupal仅在节点类型上显示块相关的知识,希望对你有一定的参考价值。

<?php
  // Only show if $match is true
  $match = false;

  // Which node types
  $types = array('book', 'news', 'anothernodetype' );

  // Match current node type with array of types
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $nid = arg(1);
    $node = node_load(array('nid' => $nid));
    $type = $node->type; 
    $match |= in_array($type, $types);
  }

  return $match;
?>

以上是关于PHP Drupal仅在节点类型上显示块的主要内容,如果未能解决你的问题,请参考以下文章