boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[resolved] Integrate Google in the search function

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Spack



Joined: 03 Mar 2004
Posts: 9
Location: Guadeloupe

PostPosted: Fri Mar 05, 2004 2:59 am    Post subject: [resolved] Integrate Google in the search function Reply with quote

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
View user's profile Send private message
Sigg3



Joined: 03 Jul 2003
Posts: 613
Location: Oslo, Norway

PostPosted: Fri Mar 05, 2004 11:46 am    Post subject: Reply with quote

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! | b2 Cafelog Resource Center
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Spack



Joined: 03 Mar 2004
Posts: 9
Location: Guadeloupe

PostPosted: Sat Mar 06, 2004 1:23 am    Post subject: Reply with quote

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
View user's profile Send private message
Sigg3



Joined: 03 Jul 2003
Posts: 613
Location: Oslo, Norway

PostPosted: Sat Mar 06, 2004 10:02 pm    Post subject: Reply with quote

Do you have any LIVE example? Your URL?
_________________
Sigg3 dot net - because you're worth it! | b2 Cafelog Resource Center
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Spack



Joined: 03 Mar 2004
Posts: 9
Location: Guadeloupe

PostPosted: Sat Mar 06, 2004 11:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Spack



Joined: 03 Mar 2004
Posts: 9
Location: Guadeloupe

PostPosted: Sun Mar 07, 2004 1:03 am    Post subject: Reply with quote

Ok now you can test http://oxygene.maxisurf.org
Back to top
View user's profile Send private message
archiguy



Joined: 05 Mar 2003
Posts: 47

PostPosted: Thu Apr 29, 2004 11:20 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group