homepage Welcome to WebmasterWorld Guest from 23.23.57.182
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Google / Google Desktop Tools and Google Labs Projects
Forum Library, Charter, Moderator: open

Google Desktop Tools and Google Labs Projects Forum

    
Linking Google Co-Op With Google API
Jeremy_H

5+ Year Member



 
Msg#: 3160618 posted 6:15 am on Nov 18, 2006 (gmt 0)

Hi,

I'm experiementing with Google Co-Op, and I want to blend the search results with my site so I'm trying the API route.

I'm having a devil of a time even getting started.

The API gives me some starter code, and the Co-Op basically says "Use your Custom Search Engine's unique identifier to connect with this API". Does that mean to make the div id equal to the API?

Just trying to link the two together I've gotten this skelaton code. While the API works, its not searching using the co-op engine.

Any ideas on how to properly link the two? I'm running in circles!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Search</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=MYAPICODE"></script>
<script type="text/javascript">
function OnLoad() {
var searchControl = new GSearchControl();
var localSearch = new GlocalSearch();
searchControl.addSearcher(localSearch);
searchControl.addSearcher(new GwebSearch());
searchControl.addSearcher(new GvideoSearch());
searchControl.addSearcher(new GblogSearch());
localSearch.setCenterPoint("New York, NY");
searchControl.draw(document.getElementById("results_MYCOOPCODE"));
searchControl.execute("<?php echo $_GET["s"];?>");
}
</script>
</head>

<body onload="OnLoad()">
<div id="results_MYCOOPCODE"></div>
<script type="text/javascript">
var googleSearchIframeName="results_MYCOOPCODE";
var googleSearchFormName="searchbox_MYCOOPCODE";
var googleSearchFrameWidth=600;
var googleSearchFrameborder=0;
var googleSearchDomain="www.google.com";
var googleSearchPath="/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
</body>
</html>

 

Jeremy_H

5+ Year Member



 
Msg#: 3160618 posted 7:39 am on Nov 19, 2006 (gmt 0)

Ah-ha! I found it:

Its actually a radically different approach than what I was trying. Here's the code modified:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Search</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=MYAPICODE"></script>
<script type="text/javascript">
function OnLoad() {
var searchControl = new GSearchControl();
var coop = new GwebSearch();
coop.setSiteRestriction("MYCOOPCODE");
searchControl.addSearcher(coop);
searchControl.draw(document.getElementById("id"));
}
</script>
</head>

<body onload="OnLoad()">
<div id="id"></div>
</body>
</html>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google Desktop Tools and Google Labs Projects
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved