Php 在Drupal中设置搜索框主题时遇到问题

Php 在Drupal中设置搜索框主题时遇到问题,php,drupal,drupal-6,themes,Php,Drupal,Drupal 6,Themes,我不是世界上最有经验的Drupal,我正在经历一场噩梦,试图定制搜索框。我正在使用Drupal帮助站点上的示例,但它根本不起作用 我已经将search-theme-form.tpl.php从搜索模块复制到我的主题中,并复制了示例代码,该代码中除预处理函数外的任何HTML都显示良好,但据我所知,预处理函数要么没有被调用,要么只是没有影响我的搜索框 我几乎可以肯定的是,我遗漏了一些关于Drupal工作原理的基本信息,但我根本找不到任何信息 代码如下: <?php function dan

我不是世界上最有经验的Drupal,我正在经历一场噩梦,试图定制搜索框。我正在使用Drupal帮助站点上的示例,但它根本不起作用

我已经将search-theme-form.tpl.php从搜索模块复制到我的主题中,并复制了示例代码,该代码中除预处理函数外的任何HTML都显示良好,但据我所知,预处理函数要么没有被调用,要么只是没有影响我的搜索框

我几乎可以肯定的是,我遗漏了一些关于Drupal工作原理的基本信息,但我根本找不到任何信息

代码如下:

 <?php 

function danland_preprocess_search_theme_form(&$vars, $hook) {
      // Remove the "Search this site" label from the form.


  $vars['form']['search_theme_form']['#title'] = t('');

  // Set a default value for text inside the search box field.
  $vars['form']['search_theme_form']['#value'] = t('Search this Site');

  // Add a custom class and placeholder text to the search box.
  $vars['form']['search_theme_form']['#attributes'] = array('class' => 'NormalTextBox txtSearch', 'onblur' => "if (this.value == '') {this.value = '".$vars['form']['search_theme_form']['#value']."';} ;", 'onfocus' => "if (this.value == '".$vars['form']['search_theme_form']['#value']."') {this.value = '';} ;" );


  // Change the text on the submit button
  //$vars['form']['submit']['#value'] = t('Go');

  // Rebuild the rendered version (search form only, rest remains unchanged)
  unset($vars['form']['search_theme_form']['#printed']);
  $vars['search']['search_theme_form'] = drupal_render($vars['form']['search_theme_form']);

  $vars['form']['submit']['#type'] = 'image_button';
  $vars['form']['submit']['#src'] = path_to_theme() . '/images/search.jpg';

  // Rebuild the rendered version (submit button, rest remains unchanged)
  unset($vars['form']['submit']['#printed']);
  $vars['search']['submit'] = drupal_render($vars['form']['submit']);

  // Collect all form elements to make it easier to print the whole form.
  $vars['search_form'] = implode($vars['search']);
}

?>


<div id="search" class="container-inline">
  <?php print $search_form; print $search_theme_form; ?>
</div>

将预处理函数放在主题目录的template.php中,然后清除admin/settings/performance中的缓存

以下是一些有用的链接,可以了解如何使用模板/预处理函数制作主题: