This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

This may seem an unusual requirement, but every now and then site owners come up with a need for a search block that does not show its results. For example, where there is a search block in a global header area directing results to a search page, but you also have a search block in the main area of the search page to show the results of the search. On that page, you probably don't want to show a second set of the search results in the header!

The easy solution is to create a custom template for the search block that does not show the search results.

Make a copy of:


to the root directory:


Open the no_results.php file you have just created.

Delete lines 23-58 inclusive so it now reads (no changes to these lines):

<?php  defined('C5_EXECUTE') or die("Access Denied."); ?> 

<?php  if (isset($error)) { ?>
  <?php echo $error?><br/><br/>
<?php  } ?>

<form action="<?php echo $this->url( $resultTargetURL )?>" method="get" class="ccm-search-block-form">

  <?php  if( strlen($title)>0){ ?><h3><?php echo $title?></h3><?php  } ?>

  <?php  if(strlen($query)==0){ ?>
  <input name="search_paths[]" type="hidden" value="<?php echo htmlentities($baseSearchPath, ENT_COMPAT, APP_CHARSET) ?>" />
  <?php  } else if (is_array($_REQUEST['search_paths'])) { 
    foreach($_REQUEST['search_paths'] as $search_path){ ?>
      <input name="search_paths[]" type="hidden" value="<?php echo htmlentities($search_path, ENT_COMPAT, APP_CHARSET) ?>" />
  <?php   }
  } ?>

  <input name="query" type="text" value="<?php echo htmlentities($query, ENT_COMPAT, APP_CHARSET)?>" class="ccm-search-block-text" />

  <input name="submit" type="submit" value="<?php echo $buttonText?>" class="ccm-search-block-submit" />


Then on any page with your global header in edit mode, click on the search block in the global header area to get the menu. Select "Custom Template" and "No Results". Save and Publish.

Leave the search block in the body of the search page with the regular template.

Note - the line numbers to delete may vary slightly with concrete5 versions.

The above template and others are now available by installing Search Block Templates.

Read more How-tos by JohntheFish.

Loading Conversation