How to display my block on search results page only if nothing found? I want to place a webform block to make user able to inform about their special queries if no search results appeared.
To expose a webform as a block, go to the webform, and under the webform>>form settings tabs go to the bottom, open up the Advanced settings, and check 'Available as block'.

Then go to /admin/structure/block find your block and click on 'Configure'. The url will have the form /admin/structure/block/manage/MODULENAME/BLOCKID/configure (MODULENAME will be 'webform', and the BLOCKID will have the form 'client-block-$nid' where $nid is the node ID of the form). Keep a record of these.

Then copy the core template from the DRUPALROOT/modules/search/search-results.tpl.php to your theme directory, and edit it to look something like:

&lt;?php if ($search_results): ?&gt;
  &lt;h2&gt;&lt;?php print t('Search results');?&gt;&lt;/h2&gt;
  &lt;ol class="search-results &lt;?php print $module; ?&gt;-results"&gt;
  &lt;?php print $search_results; ?&gt;
  &lt;/ol&gt;
  &lt;?php print $pager; ?&gt;
&lt;?php else : ?&gt;
  &lt;h2&gt;&lt;?php print t('Your search yielded no results');?&gt;&lt;/h2&gt;
  &lt;?php 
    $block = block_load('MODULENAME', 'BLOCKID');
    print drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))))
 ?&gt;
&lt;?php endif; ?&gt;


This will print your block instead of the search help if there are no search results.

Now, so your theme can use this new template, you have to make it aware. Edit the theme's template.php file and look for a function called THEMENAME_preprocess_search_result(&amp;$vars) If it exists, add the following code. If it does not exist, create it and add the following code:

THEMENAME_preprocess_search_results(&amp;$vars) {

  // ..... Existing code

  $vars['template_files'][] = 'search-results-' . $vars['module'];
}


Hope this helps.