Hi Guys,
Here is my website.
http://www.exceldesign.ca/ExcelDesign/
I am using zen theme and I want my search bar on the top right side.
any good idea to move it?
Thanks

Ming

Comments

sadashiv’s picture

You can use any of the following methods.

1) You can add following code in page.tpl.php
if ($search_box):

endif;
if you have this code in your tpl then make sure that you have enabled search module.

2) You can also try creating a region(long method) in the theme and position it using css and then assign the search block to this region.

I tried to create account but you have enabled the admin approval for account so i am waiting for the account to get approved as you have not given search permission to the anonymous user so I can't see the search box now where it is.

Hth,
Sadashiv.

kyo620724’s picture

Hi Sadashiv,
I active your account already, but I still working on the search bar. I added that code that you said in the page.tpl.php then I am looking for a search module. any good suggestion?
Well, without the module or it promts
Notice: Undefined variable: search_box in include() (line 82 of /home/content/27/10046127/html/ExcelDesign/sites/all/themes/zen/templates/page.tpl.php).

sadashiv’s picture

Edit template.php file
In theme_preprocess_page of zen add search_box variable as

$form = drupal_get_form('search_form'); //get search form
$form['basic']['keys']['#title'] = 'My Search Title'; //set search title, can even make blank
$search_box = drupal_render($form); //render the form
$variables['search_box'] = $search_box; //assign it in variables

so the function would be like

function zen_preprocess_page(&$variables, $hook) {
  // Find the title of the menu used by the secondary links.
  $secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
  if ($secondary_links) {
    $menus = function_exists('menu_get_menus') ? menu_get_menus() : menu_list_system_menus();
    $variables['secondary_menu_heading'] = $menus[$secondary_links];
  }
  else {
    $variables['secondary_menu_heading'] = '';
  }
  $form = drupal_get_form('search_form');                         //get search form 
  $form['basic']['keys']['#title'] = 'My Search Title';              //set search title, can even make blank
  $search_box = drupal_render($form);                               //render the form
  $variables['search_box'] = $search_box;                           //assign it in variables
}

This will fix the problem and you can use $search_box variable in tpl and then you can adjust the position through css.

Hth,
Sadashiv.

stefan.marin’s picture

Thanks so mutch!