Hi All,
Actually i have created a front page page--front.tpl and when i tried to display search box in front page it is not showing and i used the code which i got like below in template.php

function mytheme_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#title'] = '';
    $form['search_block_form']['#size'] = 25;
    $form_default = t('Search');
    $form['search_block_form']['#default_value'] = $form_default;
    $form['search_block_form']['#attributes'] = array('onblur' => "if (this.value == '') {this.value = '{$form_default}';}", 'onfocus' => "if (this.value == '{$form_default}') {this.value = '';}" );
  }    
}

But still i am not able to show this in front page. So can anybody help me... I am using drupal 7.x version.

Comments

alinouman’s picture

I think so search form is block got to blocks and put that block into region.

kirankumar_k’s picture

I am using search box by bloacks region only. It is working for only inner pages because it is page.tpl.php. But i am trying to use my own front page front--page.tpl.php and it is a copy of page.tpl.php, in this that block region search box is not working.

alinouman’s picture

In page.--front try this code

<?php
$block = block_load('block', '2');
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
print $output;
?>