Log in

View Full Version : Google Custom Search, searching on my site problem?


raiderlax
06-28-2007, 07:20 AM
Well I added the google custom search box to my site and I want the results shown on my site, so I created a new template called "gsearch", so I put this code in it:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<!-- end no cache headers -->
$headinclude

</head>
<body>
$header
$navbar

<br />

<!-- Google Search Result Snippet Begins -->
<center> <div id="results_000000000000000000000000000000000"></div>
<script type="text/javascript">
var googleSearchIframeName = "results_000000000000000000000000000gc";
var googleSearchFormName = "searchbox_0000000000000000000000000000c";
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></center>
<!-- Google Search Result Snippet Ends -->


<br />

$footer
</body>
</html>

Now when I'm logged into my site I use the google custom search and I see the results perfectly inside my site,

now when I'm logged out and search this comes up:

"Unable to add cookies, header already sent.
File: /home/content/t/h/o/thowkins/html/TALKFITNESS.ORG/gsearch.php
Line: 8"

Please how do I make it so that the results come up both when logged in and out???


Thanks :)

Dismounted
06-28-2007, 07:23 AM
Could you post gsearch.php?

raiderlax
06-28-2007, 07:30 AM
The code in the first post is gsearch.php, you have to put that google code on the page where you want results shown.

Dismounted
06-28-2007, 07:46 AM
You need to build a proper vBulletin-powered page.

https://vborg.vbsupport.ru/showthread.php?t=62164

raiderlax
06-28-2007, 08:06 AM
Thanks so much, got it working perfectly logged in and out!

:)

How does it look to you? www.talkfitness.org

Michael Biddle
06-28-2007, 08:31 AM
Looks good