Next Page


Previous Page

Thread: Combining Google Search with Google's Custom Search

Created on: 02/06/11 09:51 PM

Replies: 0


Joined: 08/22/10

Posts: 3

Google Search and Google's Custom Search
02/06/11 9:51 PM

The Google Custom Search integration page describes how to integrate Google's custom search service with ContentCafe. The page you create will display the form for searching and the search results of the submitted form.

You may want to have multiple search forms, perhaps in the header of each page of your site, that all submit to this search page and show the results. You can achieve this with minor changes to how you create your search results page and a new display for the Google Search element.

The first step is to create your Google search results page but rather than pasting the search code into a Text element you'll put it into a ColdFusion element that you'll add to the search results page. There are two changes you'll add to this pasted text, the first being that you'll add this line as the first line of the ColdFusion module text:

   name="form.q" default="">

The second is to add these lines after the line that reads "customSearchControl.draw('cse');":

    <cfif form.q is not "">
    // execute an initial search

This makes the search results page so that it will accept a form parameter named "q" which, if present, will cause the Google search code to execute a search with this form parameter as the search term.

The final change is to add a new display for the Google Search element. Just copy the XSL for the existing display into a text editor and change the ACTION attribute of the FORM tag to point to your ContentCafe search results page. Create a new display for the Google Search element and set the XSL to the new XSL code.

That's it! Now just add the Google Search element to your templates and pages then change the display to the new display. When the form is submitted to the search page the search results will be displayed for the term entered.
* Last updated by: keith on 2/6/2011 @ 9:54 PM *

Link | Top | Bottom

Next Page


Previous Page

New Post

Please login to post a response.