override search form template in drupal 7

10,778

Solution 1

The search block form is actually not using this template. The solution is to use the Form API in your template.php file and alter the template right there. Here is a link to the solution:

http://drupal.org/node/154137

Solution 2

First of all, are you talking about search form in block or about search form page, which is displayed at sitename.com/search? Have you flushed all caches after you placed new TPL file with your custom token? Anyway, if you want to debug yourself, try to download and enable devel_themer module (it depends on devel module too). http://drupal.org/project/devel_themer

Share:
10,778
jlightfo
Author by

jlightfo

Updated on June 04, 2022

Comments

  • jlightfo
    jlightfo almost 2 years

    I want to create my own search form template in my theme. When copy search-result.tpl.php and from the core search module into my theme it is rendered instead of the default (which is what I expected).

    However when I copy search-block-form.tpl from the search core into my theme I get nada. In fact when I place a "hello world" token in the search-block-form.tpl in the core search module it doesn't get rendered. To rephrase I need to know in what template file is the form ultimately rendered and how do I change it to the one in my theme.