drupal中根据不同的内容类型节点显示不同的样式

在template.tpl中添加如下代码:

function lee_preprocess_node(&$variables) {
  if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
    $variables['classes_array'][] = 'node-full';
  }
}

在template文件下建立模板文件node--article.tpl.php

最后清除下缓存即可!

原文地址:https://www.cnblogs.com/leeten/p/3807102.html