Modificando el formulario de búsqueda en Drupal 5.x

Para modificar el formulario de búsqueda en un tema de Drupal 5, primero hay que añadir la función que llame a la nueva plantilla en el fichero template.php, para ello añadimos el siguiente código:

<div class="codeblock"><span style="color: #000000;"><span style="color: #0000bb;">&lt;?php
</span><span style="color: #007700;">function </span><span style="color: #0000bb;">phptemplate_search_theme_form</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$form</span><span style="color: #007700;">) {
</span><span style="color: #ff8000;">/**
* This snippet catches the default searchbox and looks for
* search-theme-form.tpl.php file in the same folder
* which has the new layout.
*/
</span><span style="color: #007700;">return </span><span style="color: #0000bb;">_phptemplate_callback</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'search_theme_form'</span><span style="color: #007700;">, array(</span><span style="color: #dd0000;">'form' </span><span style="color: #007700;">=&gt; </span><span style="color: #0000bb;">$form</span><span style="color: #007700;">), array(</span><span style="color: #dd0000;">'search-theme-form'</span><span style="color: #007700;">));
}
</span><span style="color: #0000bb;">?&gt;</span></span></div>

Despues creamos un fichero nuevo en el directorio del tema llamado search-theme-form.tpl.php y añadimos el siguiente código que modificaremos a nuestro antojo.

&lt;label for="search_theme_form_keys"&gt;Custom Search&lt;/label&gt;
&lt;input type="text" maxlength="128" name="search_theme_form_keys" id="edit-search_theme_form_keys"  size="25" value="" title="Enter the terms you wish to search for." class="form-text" /&gt;
&lt;input type="submit" name="op" value="Search"  /&gt;
&lt;input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form" /&gt;
&lt;input type="hidden" name="form_token" id="a-unique-id" value="<span style="color: #000000;"><span style="color: #0000bb;">&lt;?php </span><span style="color: #007700;">print </span><span style="color: #0000bb;">drupal_get_token</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'search_theme_form'</span><span style="color: #007700;">); </span><span style="color: #0000bb;">?&gt;</span></span>" /&gt;

Fuente:
Customising the search forms

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>