Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
To display a "search form block" (a drupal core block) in a custom theme file
echo module_invoke('search', 'block', 'view', 0);
The above function will return
Array
(
[content] =><form action="/drupal5/" accept-charset="UTF-8" method="post" id="search-block-form">
<div><div class="container-inline"><div class="form-item" id="edit-search-block-form-keys-wrapper">
<input type="text" maxlength="128" name="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" />
</div>
<input type="submit" name="op" id="edit-submit" value="Search" class="form-submit" />
<input type="hidden" name="form_token" id="edit-search-block-form-form-token" value="ac4853e8f1f0280b08a1208def60093e" />
<input type="hidden" name="form_id" id="edit-search-block-form" value="search_block_form" />
</div>
</div>
</form>
[subject] => Search
)
if you want to apply custom css style to your search form block refer
http://drupal.org/node/108467
This is my first snippet will write more in future (thanks to dereline #drupal)
Comments
correction..
need to remove the first paren before module_invoke.
paren removed
Fixed - thanks!
˚ ˚ ˚ ˚ ˚
Kristi Wachter
Drupal consultant, evangelist, and enthusiast
to remove the label or the search button
this still works in 6.20
if you dont want the label and the search button:
//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong