Search box (etc) Positioning in Drupal7

It is not uncommon for front-end designers (the polite phrase to use when people say what a website should look like and don't doing any coding themselves) ask for a search box or similar elements to be located outside the standard blocks in Drupal. Without some background knowledge, this can be somewhat frustrating.

To incorporate the search box out of normal bounds, a modification the page.tpl.php file is required. In Drupal this is located under the themes directory (e.g., /drupal/themes/pushbutton/page.tpl.php. In Drupal versions 5 and 6 it is simply a matter of adding the $search_box variable where you want it and away you go. For example;

However this variable doesn't exist in Drupal 7. Instead a preprocess function is required in the template.php file.

function theme-name_preprocess_page(&$vars) {
  if (isset($vars['node_title'])) {
    $vars['title'] = $vars['node_title'];
/*
 *  Preprocess page.tpl.php to inject the $search_box variable back into D7.
 */

  $search_box = drupal_render(drupal_get_form('search_form'));
  $vars['search_box'] = $search_box;
  }
}