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: 132 Location: Oslo, Norway
|
Posted: Fri Mar 05, 2004 11:46 am Post subject: |
|
|
This is something I could like too, but I find it more sensible to just use a google-search engine. (http://sigg3.net/sitemap.html#search) _________________ Sigg3 dot net - because you're worth it! |
|
Back to top |
|
 |
Spack
Joined: 03 Mar 2004 Posts: 9 Location: Guadeloupe
|
Posted: Sat Mar 06, 2004 1:22 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: 132 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 |
|
 |
|