Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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
Templates Drupal7:theme#uHook#uSuggestions列出了模板,但不是';我不能用它_Templates_Drupal 7 - Fatal编程技术网

Templates Drupal7:theme#uHook#uSuggestions列出了模板,但不是';我不能用它

Templates Drupal7:theme#uHook#uSuggestions列出了模板,但不是';我不能用它,templates,drupal-7,Templates,Drupal 7,我有一个自定义模块,用于在多个级别列出位置(radius邮政编码搜索、城市范围、州范围、全国范围)。每个级别的模板都可以正常工作,但我目前正在尝试为城市位置创建一个例外模板 该级别的hook_theme()条目的模板设置为“module--result city”,在预处理主题中,我有: function template_preprocess_mymodule_result_city(&$vars){ ... $vars['theme_hook_suggestions'

我有一个自定义模块,用于在多个级别列出位置(radius邮政编码搜索、城市范围、州范围、全国范围)。每个级别的模板都可以正常工作,但我目前正在尝试为城市位置创建一个例外模板

该级别的hook_theme()条目的模板设置为“module--result city”,在预处理主题中,我有:

function template_preprocess_mymodule_result_city(&$vars){
    ...
    $vars['theme_hook_suggestions'][] = 'mymodule__result_city__' . $state . '_' . $city;
}
我将州添加到名称中,因为城市名称在全国范围内重复(专门针对我们)

我将$conf['theme_debug']=TRUE;在my settings.php中,查看源代码,我看到它有一个正确的模板文件作为选项列出,但它使用默认的模块模板

<!-- FILE NAME SUGGESTIONS:
   * mymodule--result-city--la-new-orleans.tpl.php
   x mymodule--result-city.tpl.php
   * mymodule-result-city.tpl.php
-->
我删除了“模式”=>“我的模块结果城市”行


感谢您的帮助

尝试在hook_主题中使用下划线代替模板的连字符。无论如何,当它搜索文件时,它们会转换为连字符。为我修复了它。尝试在hook_主题中使用下划线代替连字符作为模板。无论如何,当它搜索文件时,它们会转换为连字符。帮我修好了。
$theme['mymodule_result_city'] = $base + array(
    'template' => 'mymodule--result-city',
    'variables' => array(
        'search' => NULL,
    ),
);