TinyPortal

Development => Block Codes => Topic started by: Nokonium on January 02, 2007, 07:06:17 AM

Title: Trying to get Google Search block open in the center to display the results
Post by: Nokonium on January 02, 2007, 07:06:17 AM
I'm working on this with a co-admin and we are now stumped. We want to open the search results in the center frame, as does SMF search. The best we have achieved so far is to open it in an article. The problem with that is the article will only load if it is the featured article or as an article in a block. A simple link to the article works fine. If you take away target="_top" TP screws up.

We want to do this so that peeps using the Google Search do not go off of the site to display the results, say if you use it for a site search.

This is what we have

The block code
<!-- Search Google -->
<div align="center">
<form method="get" action="http://nokonium.co.uk/Ragmans-Trumpet/index.php?page=19 target="_top">
<table bgcolor="#F7F2E9">
<tr><td nowrap="nowrap" valign="top" align="center" height="32">

<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="12" maxlength="255" value="" id="sbi"></input>
</td></tr>
<tr><td valign="top" align="center">
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Google Search" id="sbb"></input>
<input type="hidden" name="client" value="############"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="########"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="safe" value="active"></input>
<input type="hidden" name="flav" value="0000"></input>
<input type="hidden" name="sig" value="#########"></input>
<input type="hidden" name="cof" value="GALT:#993333;GL:1;DIV:#663300;VLC:993333;AH:center;BGC:F7F2E9;LBGC:FFFFCC;ALC:993333;LC:993333;T:993333;GFNT:993333;GIMP:993333;FORID:11"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
</div>
<!-- Search Google -->


The article code
<!-- Google Search Result Snippet Begins -->

<div id="googleSearchUnitIframe"></div>

<script type="text/javascript">
   var googleSearchIframeName = 'googleSearchUnitIframe';
   var googleSearchFrameWidth = 700;
   var googleSearchFrameborder = 0 ;
   var googleSearchDomain = 'www.google.co.uk';
</script>
<script type="text/javascript"
         src="http://www.google.com/afsonline/show_afs_search.js">
</script>
<!-- Google Search Result Snippet Ends -->
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: whoflungdoo on February 10, 2007, 04:36:57 PM
How about making a menu item with a link to your article, so when its clicked, the article opens in the center, only the article has an iframe with the src = to your stand alone page?
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Nokonium on February 10, 2007, 10:18:55 PM
Quote from: whoflungdoo on February 10, 2007, 04:36:57 PM
How about making a menu item with a link to your article, so when its clicked, the article opens in the center, only the article has an iframe with the src = to your stand alone page?

The google code in the article is for an iframe.

Clicking search on the Google Search block opens the article and fills the iframe with the search result. Even that is not happening for just an article shown on the front page or not in the alpha version that I am testing. I can however still open the article if it is in a block, without a title or frame, so that it is invisible until filled. That works in IE7, FF2 and Opera.

The problem remaining is then to open a selected search link in the search results iframe.
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Nokonium on February 10, 2007, 11:42:04 PM
A couple of other bits

_top can be replaced by _parent, _self, but to no avail

<base target="_####"> can be added to the article, it doesn't show as code (I know it should be in the head) but doesn't work either.
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: tick on March 20, 2007, 10:17:58 PM
did this ever get worked out?
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Nokonium on March 21, 2007, 08:18:29 PM
No, I still can't get it to work.
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: tick on March 21, 2007, 08:20:15 PM
I think this would be a pretty cool addition to my site.  I will keep a watch on this to see how it is coming
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Nokonium on March 22, 2007, 08:58:18 PM
There are two parts to the problem

Getting an ordinary article to open with the Google search results

Getting the site/page from a link to open in the results i-frame, as it does if you do a Google search on the google site.
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: tick on March 22, 2007, 09:13:33 PM
I wish I could help, but my  knowledge in coding and such is very limited
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Nokonium on March 22, 2007, 10:47:58 PM
I wish I could solve it,  :(

maybe someone else has some ideas?
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Zetan on June 16, 2007, 11:18:46 PM
I may have it,

1) I made an frontpage article - iframe (id=search name=search) to a blank file search.htm

<CENTER><IFRAME name=search id=search src="/google/search.htm" width="98%" height=510>you don't support iframes</IFRAME></CANTER></CENTER>

2) Made a block with the adsense search script. (In the first line I put target="search" to match the top)

<form method="get" action="http://www.google.com/custom" target="search">

Now it links from the SEARCH BLOCK to the FRONTPAGE ARTICLE. My problem is that I have to have the article on the front page visable. If anybody can help me, I need the command to make visable a hidden frontpage article so I can put it into the search script block to activate (make visable) the hiddle artcle for the output of the search script.

(ALMOST there!  :-\)


Title: Re: Trying to get Google Search block open in the center to display the results
Post by: martinmarinekeeper on June 17, 2007, 12:07:37 AM
try making it top colum ?

take it yourrunning it on smf default ?
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Zetan on June 17, 2007, 06:33:24 AM
I am running SMF v1.1.2 and TinyPortal v0.9.8 and Helios Theme with the empty article on the frontpage with a google block that outputs to a center frontpage the problem is that I have to have the atricle visable for it to work I want to know how to enable an invisable frontpage center block article to make it visable, using code.
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: bloodlust on July 21, 2007, 01:12:30 PM
OK...I've got it!

1: Create the google search code using the "Show results on my page" option.

2: Create a new article (it doesn't have to show on the front page).

3: Paste the code from the second box on the google search code (Your search results code:) in the source of your article.  (You do not need to alter this code in any way)

4: You are going to need to edit search box code slightly.

Here is the default code you will be given from google for the search box:

<!-- SiteSearch Google -->
<form method="get" action="http://www.yoursite.com/index.php?page=23" target="_top">
<table border="0" bgcolor="#000000">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25blk.gif" border="0" alt="Google" align="middle"></img></a>
<br/>
<input type="hidden" name="domains" value="www.yoursite.com"></input>
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="10" maxlength="255" value="" id="sbi"></input>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Search" id="sbb"></input>
</td></tr>
<tr>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#ffffff">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="www.yoursite.com" id="ss1"></input>
<label for="ss1" title="Search www.yoursite.com"><font size="-1" color="#ffffff">www.yoursite.com</font></label></td>
</tr>
</table>
<input type="hidden" name="client" value="pub-8629480975977626"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="cof" value="GALT:#FF8800;GL:1;DIV:#555555;VLC:FFCC00;AH:center;BGC:222222;LBGC:000000;ALC:FF8800;LC:FF8800;T:FFFFFF;GFNT:FFCC00;GIMP:FFCC00;FORID:11"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->


On about line 8 you should have this:

<input type="hidden" name="domains" value="www.yoursite.com"></input>


5: Replace the word "domains" with the word "page" and replace the url for "value" with the page number of the article you created in step 2.

Line 8 should now look like this:

<input type="hidden" name="page" value="23"></input>


6: Create a new script block

7: Paste your new Search box code in your new script block.

It should work now! :)


Title: Re: Trying to get Google Search block open in the center to display the results
Post by: mmcbrien on July 25, 2007, 09:41:10 PM
My Search box code is vastly different then yours ShawnX

Heres what I have.

<!-- Google CSE Search Box Begins -->
  <form id="searchbox_007942790335138847215:ikwl2tqfuxw" action="http://www.norareef.org/index.php?page=14">
    <input type="hidden" name="cx" value="007942790335138847215:ikwl2tqfuxw" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input name="q" type="text" size="40" />
    <input type="submit" name="sa" value="Search" />
  </form>
  <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_007942790335138847215%3Aikwl2tqfuxw"></script>
<!-- Google CSE Search Box Ends -->
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: bloodlust on July 26, 2007, 12:36:10 AM
Quote from: mmcbrien on July 25, 2007, 09:41:10 PM
My Search box code is vastly different then yours ShawnX

It appears you're using Google's Custom Search Engine (http://www.google.com/coop/cse) service.

My instructions are for Google's Adsense for Search (https://www.google.com/adsense/login/en_US/) service ;)
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Blue Steel on July 26, 2007, 07:36:06 AM
Thanks ShawnX I've been trying to get that to work for almost 2 weeks now lol
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: mmcbrien on July 26, 2007, 10:03:37 PM
Oi I feel dumb...  /me crawls into a corner.
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Wonga on July 28, 2007, 12:54:30 AM
Thanks, works great on my site.  8)
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: bloodlust on July 28, 2007, 01:22:34 AM
Glad I could help guys :)
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: cru on August 18, 2007, 10:18:38 AM
hi, i used the adsense for search set up, but i dont see the line

<input type="hidden" name="domains" value="www.yoursite.com"></input>

here's the code i got
<!-- Search Google -->
<center>
<form method="get" action="http://mysite.net/index.php?page=5" target="_top">
<table bgcolor="#cccccc">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">

<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="23" maxlength="255" value="" id="sbi"></input>
</td></tr>
<tr><td valign="top" align="left">
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Google Search" id="sbb"></input>
<input type="hidden" name="client" value="pub-x1679330x51556xx"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="3486207923"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="flav" value="0001"></input>
<input type="hidden" name="sig" value="TmsTOszkCQM1qZIr"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:E6E6E6;LBGC:336699;ALC:0066CC;LC:0066CC;T:000000;GFNT:0066CC;GIMP:0066CC;FORID:11"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
</center>
<!-- Search Google -->


how do i tweak it?
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: Zetan on August 18, 2007, 10:26:26 AM
You don't tweak any Google codes.

Where are you pasting the code? Block type?

Is this just a Google search engine or AdSense?


Totally ignore my reply.. I didn't realise this was a work in progress topic  :idiot2:
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: falguni1 on August 18, 2007, 11:43:05 AM
whers is the second code when you want to display it in your page you get 2 codes put the 2nd code in an html box in the center panel
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: cru on August 18, 2007, 01:07:43 PM
Quotewhers is the second code when you want to display it in your page you get 2 codes put the 2nd code in an html box in the center panel

here it is, i pasted it in my article. it does not work. it just brings me back to my homepage when i try searching.

<!-- Google Search Result Snippet Begins -->
<div id="googleSearchUnitIframe"></div>

<script type="text/javascript">
   var googleSearchIframeName = 'googleSearchUnitIframe';
   var googleSearchFrameWidth = 600;
   var googleSearchFrameborder = 0 ;
   var googleSearchDomain = 'www.google.com';
</script>
<script type="text/javascript"
         src="http://www.google.com/afsonline/show_afs_search.js">
</script>
<!-- Google Search Result Snippet Ends -->
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: bloodlust on August 19, 2007, 02:26:41 AM
Quote from: cru on August 18, 2007, 10:18:38 AM
hi, i used the adsense for search set up, but i dont see the line

<input type="hidden" name="domains" value="www.yoursite.com"></input>

here's the code i got
<!-- Search Google -->
<center>
<form method="get" action="http://mysite.net/index.php?page=5" target="_top">
<table bgcolor="#cccccc">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">

<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="23" maxlength="255" value="" id="sbi"></input>
</td></tr>
<tr><td valign="top" align="left">
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Google Search" id="sbb"></input>
<input type="hidden" name="client" value="pub-x1679330x51556xx"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="3486207923"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="flav" value="0001"></input>
<input type="hidden" name="sig" value="TmsTOszkCQM1qZIr"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:E6E6E6;LBGC:336699;ALC:0066CC;LC:0066CC;T:000000;GFNT:0066CC;GIMP:0066CC;FORID:11"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
</center>
<!-- Search Google -->


how do i tweak it?

You seem to be missing quite a bit of code for your search box.  You might try creating a new box and see if you get the entire code.  I just made one and here's what I get for the search box:
Quote
<!-- SiteSearch Google -->
<form method="get" action="http://www.yoursite.com/index.php?page=5" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">

<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></img> (http://www.google.com/)
</td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="www.yoursite.com"></input>
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Search" id="sbb"></input>
</td></tr>
<tr>
<td>&nbsp;</td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="www.yoursite.com" id="ss1"></input>
<label for="ss1" title="Search www.yoursite.com"><font size="-1" color="#000000">www.yoursite.com</font></label></td>
</tr>
</table>
<input type="hidden" name="client" value="pub-8629480975977626"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="safe" value="active"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:11"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: cru on August 21, 2007, 02:46:40 PM
 i noticed this line is there when i  enable Google WebSearch + SiteSearch.
<input type="hidden" name="domains" value="www.yoursite.com"></input>

my problem is, when users use the "Search this site" option, it only searches from articles within the site, and does not search the forums.

Now what i want to do is enable the Google web search only, without the site search.

Anybody who tried tweaking it without this code?
<input type="hidden" name="domains" value="www.yoursite.com"></input>

coz this code (above) is not there when i use the Google web search only. TIA
Title: Re: Trying to get Google Search block open in the center to display the results
Post by: bloodlust on August 22, 2007, 04:24:44 PM
That's weird.  It searches forum posts on my site.  :-\

Yeah.. I don't see the code either when doing Web Search only option.

You could try this:

1: Follow my directions Here (http://www.tinyportal.net/index.php?topic=11958.msg145303#msg145303) for getting the search results to show up in your site.  Make sure to use the Google WebSearch + Site Search option.

2: In your Search Box Code:

Find this:

<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="www.yoursite.com" id="ss1"></input>
<label for="ss1" title="Search www.yoursite.com"><font size="-1" color="#000000">www.yoursite.com</font></label></td>
</tr>


Replace with this:

<tr>
<td>
<input type="hidden" name="sitesearch" value="" checked id="ss0"></input>
&nbsp;
<td>
<input type="hidden" name="sitesearch" value="www.yoursite.com" id="ss1"></input>
&nbsp;</td>
</tr>


This will make Web Search checked by default (which it is already unless you change it at the beginning), and hide the radio buttons and labels so your visitors can't select Site Search.

Of course make sure to replace "www.yoursite.com" with your site's URL ;)