Our Blog

Recent Posts

Categories

10Sep

Howto quickly theme the Drupal 6 search form

When you get a whole website in html and need to quickly turn it into a Drupal theme look for a way to reuse what you already have. If you need to theme a search form, just theme the search box and reuse the html/css you already got. Create a file named block-search.tpl.php in your sites/all/themes/your_theme_name directory and add following code:
<form action="<?php echo $base_path; ?>search/node" accept-charset="UTF-8" method="post" id="search-theme-form">
<div id="search">
      <div class="search-input-box">
      <input type="text" class="search-input" id="edit-search-theme-form-1" value="" size="10" onclick="this.value = 'Search...'" onblur="if (!this.value) this.value = 'search...'" name="keys" />
      </div>
     <div class="search-button"> <input type="image" name="Pretraga" id="Pretraga" src="<?php print base_path() . path_to_theme() .'/img/foward.png'; ?>" />
      </div>
      <input type="hidden" value="<?php print drupal_get_token('search_form'); ?>" name="form_token" />
      <input type="hidden" value="search_form" id="edit-search-form" name="form_id" />
   </div>
</form>
Categorised under: Drupal