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
Drupal 我可以用.tpl文件重写主题函数吗?_Drupal_Drupal 6 - Fatal编程技术网

Drupal 我可以用.tpl文件重写主题函数吗?

Drupal 我可以用.tpl文件重写主题函数吗?,drupal,drupal-6,Drupal,Drupal 6,如何使用.tpl文件覆盖主题函数?我知道如何用主题函数覆盖.tpl文件,但反过来不行。我似乎找不到任何地方能告诉我这一点,所以也许这是不可能的,或者不是好的做法 例如,如果在名为super_results的模块中定义了一个主题函数,并在主题注册表中注册,如下面的示例所示,我将如何使用super_results.tpl.php覆盖它 'super_results' => array( 'arguments' => array('title' => NULL, 'res

如何使用
.tpl
文件覆盖主题函数?我知道如何用主题函数覆盖
.tpl
文件,但反过来不行。我似乎找不到任何地方能告诉我这一点,所以也许这是不可能的,或者不是好的做法

例如,如果在名为
super_results
的模块中定义了一个主题函数,并在主题注册表中注册,如下面的示例所示,我将如何使用
super_results.tpl.php
覆盖它

'super_results' => array(
      'arguments' => array('title' => NULL, 'results' => NULL, 'votes' => NULL),
    ),

function modulename_super_results($title, $results,$votes){ output HTML }

最简单的解决方案可能是创建一个使用模板的新主题功能。类似的东西应该可以工作,免责声明代码未经测试

function my_theme_theme() {
  return array(
    'overide' => array(
      'template' => 'elm-super_results',
      'arguments' => array('title' => NULL, 'results' => NULL, 'votes' => NULL),
    ),
  );
}

function my_theme_super_results($title, $results, $votes) {
  return theme('overide', $title, $results, $votes);
}

那太聪明了。谢谢你,谷歌人:)