Best way to programmatically embed the Search Block in Drupal 7


/ 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 template_preprocess_page(&$variables){
  6. $search_box = drupal_render(drupal_get_form('search_form'));
  7. $variables['search_box'] = $search_box;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.