Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7主题\u挂钩\u建议不起作用_Drupal_Drupal 7_Drupal Views - Fatal编程技术网

Drupal 7主题\u挂钩\u建议不起作用

Drupal 7主题\u挂钩\u建议不起作用,drupal,drupal-7,drupal-views,Drupal,Drupal 7,Drupal Views,如何为一个视图添加2显示替代 这就是我的代码: function yourthemename_preprocess_html(&$vars) { if (arg(0) == 'qrule') { $vars['theme_hook_suggestions'][] = 'html__qrule'; } } HTML模板页面名为:HTML--qrule.tpl.php 这个很好用!(谢谢@Ionut.A) 但是我还想用page--qrule.

如何为一个视图添加2显示替代

这就是我的代码:

function yourthemename_preprocess_html(&$vars) {
  if (arg(0) == 'qrule') {        
    $vars['theme_hook_suggestions'][] = 'html__qrule';        
  }
}
HTML模板页面名为:
HTML--qrule.tpl.php

这个很好用!(谢谢@Ionut.A)

但是我还想用
page--qrule.tpl.php
覆盖
page.tpl.php
,但是当我添加以下内容时:

function mythemename_preprocess_html(&$vars) {
  if (arg(0) == 'qrule') {        
    $vars['theme_hook_suggestions'][] = 'html__qrule'; 
    $vars['theme_hook_suggestions'][] = 'page__qrule';    
  }
}
页面模板页面名为:
PAGE--qrule.tpl.php

我得到这个错误:

Fatal error: Only variables can be passed by reference in /var/www/vhosts/xxx/public_html/sites/all/themes/themename/page--qrule.tpl.php on line 1
有人知道我做错了什么吗

谢谢
C

如果要为page.tpl.php文件添加主题挂钩建议,则需要在
hook\u preprocess\u page()中添加主题挂钩建议:

function mythemename_preprocess_page(&$vars) {
  $vars['theme_hook_suggestions'][] = 'page__qrule';
}