【问题标题】:Drupal adding a custom header per nodeDrupal为每个节点添加一个自定义标头
【发布时间】:2013-06-18 21:07:26
【问题描述】:

我创建了模板 html-landing.tpl.php 并尝试将其包含在模板中,并在我的 template.phpenter code here

中包含以下内容

function myfuntion_preprocess_html(&$variables, $hook) {

$node = menu_get_object();

if ($node->nid == 60) {

$variables['theme_hook_suggestions'][] = 'html-landing';

} }

代码被调用,但使用的模板是标准的html.tpl.php。

有什么想法吗?

【问题讨论】:

    标签: templates drupal-7 drupal-themes


    【解决方案1】:

    你试过用下划线代替破折号吗?

    我会选择这样的:

    function myfunction_preprocess_html(&$variables, $hook) {
      $node = menu_get_object();
      if ($node && $node->nid == 60) {
        $variables['theme_hook_suggestions'][] = 'html_landing';
      }
    }
    

    更多详情http://drupal.org/node/190815#comment-4167060

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-01
      • 2020-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多