View previous topic :: View next topic |
Author |
Message |
Spack
Joined: 03 Mar 2004 Posts: 9 Location: Guadeloupe
|
Posted: Fri Mar 05, 2004 2:59 am Post subject: [resolved] Integrate Google in the search function |
|
|
I want integrated Google with the search function of the blog with radio button...How can I do that...???
Last edited by Spack on Sat Mar 06, 2004 1:23 am; edited 1 time in total |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 613 Location: Oslo, Norway
|
|
Back to top |
|
 |
Spack
Joined: 03 Mar 2004 Posts: 9 Location: Guadeloupe
|
Posted: Sat Mar 06, 2004 1:23 am Post subject: |
|
|
I found how to integrate google...Create a new script in b2 directory I named it "search.php" :
Code: | <?php
if ($_POST['where'] == 'blog') {
header("Location: index.php?s=".$_POST['s']);
}
elseif ($_POST['where'] == 'web') {
$hl = 'fr';
$ioe = 'UTF-8';
$q = $_POST['s'];
$meta = 'lr%3Dlang_fr';
header("Location: http://www.google.fr/search?hl=".$hl."&ie=".$ioe."$oe=".$ioe."&q=".$q."&meta=".$meta);
}
?> |
I speak french so change the variable for your language...Make a search in Google and look the adress bar you can see how to change...
And change the search form in your main page :
Code: | <form name="searchform" method="post" action="search.php">
<p>
<input type="text" name="s" size="15" /><br />
<input type="radio" name="where" value="web"> web </input><input type="radio" name="where" value="blog"> blog </input><br />
<input type="submit" name="submit" value="search" />
</p>
</form> |
It's all... |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 613 Location: Oslo, Norway
|
|
Back to top |
|
 |
Spack
Joined: 03 Mar 2004 Posts: 9 Location: Guadeloupe
|
Posted: Sat Mar 06, 2004 11:26 pm Post subject: |
|
|
Not for the moment...And I have changed the "search.php" file for modify the spaces in "+"...
Code: | <?php
if ($_POST['where'] == 'blog') {
$s = str_replace(' ', '+', $_POST['s']);
header("Location: index.php?s=".$s);
}
elseif ($_POST['where'] == 'web') {
$hl = 'fr';
$ioe = 'UTF-8';
$q = str_replace(' ', '+', $_POST['s']);;
$meta = 'lr%3Dlang_fr';
header("Location: http://www.google.fr/search?hl=".$hl."&ie=".$ioe."$oe=".$ioe."&q=".$q."&meta=".$meta);
}
?> |
|
|
Back to top |
|
 |
Spack
Joined: 03 Mar 2004 Posts: 9 Location: Guadeloupe
|
|
Back to top |
|
 |
archiguy
Joined: 05 Mar 2003 Posts: 47
|
Posted: Thu Apr 29, 2004 11:20 am Post subject: |
|
|
if someone likes my script, mail me
Code: | <form method="GET" action="<?=$blogfilename?>" >
<p>
<input class="forminput" TYPE="text" name="s" size="15" maxlength="255" value="">
<input type="submit" name="sa" size="31" VALUE="Search" class="forminput"
onMouseOver="this.className='forminputover';"
onMouseOut="this.className='forminput';"
onClick="this.form.q.value=this.form.s.value;if(this.form.sitesearch[0].checked){ this.form.q.value=''; this.form.domains.value=''; this.form.cof.value='';} ";>
<input type="hidden" class="forminput" TYPE="text" name="q" size="31" maxlength="255" value="temp">
<input type="hidden" name="domains" value="archiguy.com">
<input type="hidden" name="cof" VALUE="GALT:#AAAAAA;S:http://www.archiguy.com;GL:1;AH:center;BGC:#000000;LH:45;LC:#FFAA00;GFNT:#AAAAAA;L:http://www.archiguy.com/archiguy.jpg;ALC:#FFFF00;BIMG:http://www.archiguy.com/images/fond2.gif;LW:150;T:#ffcc66;GIMP:#AAAAAA;VLC:#AAAAAA;LC:#AAAAAA;AWFID:ce65cc12c639c738;">
<br />
with
<input type="radio"
onclick="this.form.action='<?=$blogfilename?>';"
name="sitesearch" checked>B2
<input type="radio" name="sitesearch"
onclick="this.form.action='http://www.google.com/custom';"
value="archiguy.com">Google
</p>
</form> |
just replace your form by this one and change the line : <input type="hidden" name="cof"....... by yours and value="archiguy.com"
How to use it _________________ Archiguy
http://www.archiguy.com
Mais qu'est ce qu'il m'arrive? |
|
Back to top |
|
 |
|