i am using the Drupal 7 version of google cse. Currently when a search is executed, an external block opens up to the same page. Does anyone know how to open the results page to a new Drupal node on your website? I've looked everywhere and tried manipulating the results template but I still can't figure out how to target the results page to a different node on my Drupal site. Please, any help would be greatly appreciated.

Comments

herveyallen’s picture

Clearly not necessarily how the average person will want to fix this, but... I went in to:

sites/all/modules/contrib/google_cse

and I edited:

google_cse.theme.inc

I updated the following code snippet:

/**
* Form builder for the searchbox forms.
*/
function google_cse_results_searchbox_form($form, &$form_state) {
$form = array();
if (variable_get('google_cse_results_display', 'here') == 'here') {
$cof = variable_get('google_cse_cof_here', 'FORID:11');
}

with one additional line:

$form['#action'] = 'https://' . $_SERVER['SERVER_NAME'] . '/cse';

so that the initial "if" clause now reads:

if (variable_get('google_cse_results_display', 'here') == 'here') {
$form['#action'] = 'https://' . $_SERVER['SERVER_NAME'] . '/cse';
$cof = variable_get('google_cse_cof_here', 'FORID:11');
}

Notes:

* I presumed "https" here. You could improve the code to either test for https, or not presume.
* You need to create a basic page in Drupal with a URL alias of "cse" - I left this page blank and gave it a title of Search (which end up at the bottom of the page after the search results. Still working on that)

alexmoreno’s picture

Category: Task » Feature request
Priority: Normal » Minor
andrewjaykirkpatrick’s picture

If you need to remove the Title when displayed at the bottom of the search results, you can use:

#page-title{display:none}
afinnarn’s picture

Status: Active » Closed (won't fix)

No new feature requests for D7, but this will be considered for the Drupal 8 version.