adding drupal search in page.tpl in d7


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. /*
  3.  * Preprocess page.tpl.php to inject the $search_box variable back into D7.
  4.  */
  5. function MYTHEME_preprocess_page(&$variables){
  6. $search_box = drupal_render(drupal_get_form('search_form'));
  7. $variables['search_box'] = $search_box;
  8. }
  9. ?>
  10. Then you just need to print the variable in your page.tpl.php:
  11. <?php print $search_box; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.