I am struggling with getting a permanent search box to work in my customized theme.

Originally, the theme simply had this line - no if/endif, this can't be right, even for normal drupal use? $search_box is simply a boolean value (this is from friendselectric page.tpl.php)

  <?php print $search_box ?>

Then I looked at some similar forum topics, cobbled together the following code - this does not work fully - when I enter keywords in the header search box, it takes me to a new page, which has the search box in the body, and asks to enter keywords again, and this time it searches fine.
So, following code is missing the part which passses keywords to the search page - any hints on what to try next?

<form action="<?php print url("search") ?>" method="post">
  <div id="search">
   <input type="text" maxlength="128" name="edit[search_block_form_keys]" id="edit-search_block_form_keys"  size="15" value="" title="Enter the terms you wish to search for." class="form-text" />
   <input type="submit" name="op" value="Search1"  class="form-submit" />
   <input type="hidden" name="edit[form_id]" id="edit-search-block-form" value="search_block_form"  />
  </div>
</form>

Comments

bwooster47’s picture

So, after tearing all my hair, found it was all configuration in multiple places.

Make sure that search access control is allowed for anonymous users.

Then, go into the theme configuration, and it had a "enable search box" check box. Check this.

All done! Use the CSS file to control look, and it now all works fine - just have the print $search_box line in the template files where you need the search box.