[BETA] Google Integrated Search

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

[BETA] Google Integrated Search

Post by pentapenguin »

Google Integrated Search
This MOD uses the Google API to allow searching of your site or the web with Google.
This is a bit difficult to explain, so you can see a live demo by going to pentapenguin.com and trying it out there.

FAQs
Q. Why do I get this error: "You must enter your Google license key in search.php!"
A. You must get a free license key from Google (see next FAQ for more details).
Then open search.php
Find:

Code: Select all

$google_key = '';
And change to something like this:

Code: Select all

$google_key = 'my_google_license_key_here';
Q. How do I get a key?
A. It's free, fast, and easy. Just go to the Google API page and register.

Q. Why do I get odd results?
A. The Google API is still in beta so occasionally you may get unexpected results.

Q. Why do I get 27,000 matches but only 100 pages (instead of 2700 pages)?
A. Sorry, but the Google API will only return a maximum of 1000 results and thus 100 pages.

Q. What is the NuSOAP thing bundled with this?
A. NuSOAP is a PHP class for accessing SOAP (Simple Object Access Protocol).
Including this saves me from reinventing the wheel. ;) (And it's also the only way to access the API.)

Q. Where can I learn more about the Google API?
A. Tons more info here.

Q. Is there a limit of how many searches I can do?
A. Unfortunately, Google only lets you do 1000 searches per day. However, this is plenty for most boards.

Q. How come I'm not getting any results from my site?
A. Several things: first, install the Guest Sessions MOD which will help the Google bot index your forum.
Second, I recommend reading up on SEO (search engine optimization).

Q. How do I search my entire site and not just the forums?
A. Find this line in search.php:

Code: Select all

$google_query = ( $search_where == 'site' ) ? $search_keywords . ' site:' . $board_config['server_name'] . $board_config['script_path'] : $search_keywords;
Replace with:

Code: Select all

$google_query = ( $search_where == 'site' ) ? $search_keywords . ' site:' . $board_config['server_name'] : $search_keywords;
Download
:arrow: Download

Code: Select all

##############################################################
## MOD Title: Google Integrated Search
## MOD Author: pentapenguin < pentapenguin@bluebottle.com > (n/a) http://www.pentapenguin.com
## MOD Description: This MOD uses the Google API to allow searching of your site or the web with Google.
## MOD Version: 0.1.0
##
## Installation Level: Easy
## Installation Time:  5 Minutes
## Files To Edit: 3
## search.php
## language/lang_english/lang_main.php
## templates/subSilver/search_body.tpl
##
## Included Files: 2
## templates/subSilver/google_search_results.tpl
## includes/nusoap.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## Support for this MOD may be found at http://www.phpbb.com/phpBB/viewtopic.php?t=282881 or at 
## http://www.pentapenguin.com/forum/viewtopic.php?t=633
##
## This MOD is EasyMOD friendly! (http://area51.phpbb.com/phpBB/viewtopic.php?sid=&f=17&t=15391)
##
## Optional step: if you have CyberAlien's eXtreme Styles MOD (http://www.phpbb.com/phpBB/viewtopic.php?t=125251), 
## you can copy the file in contrib/admin/xs_google_integrated_search.cfg to admin/xs_google_integrated_search.cfg and you will
## be automatically notified if there's an update available when you use the "check for updates" function.
##
## IMPORTANT NOTE: You ***MUST*** obtain a free Google API key by going to http://www.google.com/apis/
## Then you must enter it in the search.php file.
## Make this line $google_key = ''; look like this: $google_key = 'your_google_key_here';
##
## This MOD is bundled with NuSOAP. 
## For more information, see http://dietrich.ganx4.com/nusoap/ or http://sourceforge.net/projects/nusoap/
##
## Recommended additional MOD: I suggest you use the Guest Sessions MOD to help the Google bot index your 
## forum more easily. It may be found here: http://www.phpbbstyles.com/viewtopic.php?t=357
##
## Additional style support is included for the Aphrodite style.
## For full directions, see styles/style_aphrodite.txt
##############################################################
## MOD History:
##
##   2005-04-18 - Version 0.1.0
##      - First Public Beta
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
Post ID: pentagoogle
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit »

Sounds good, though wouldn't all you had to do was add some GET vars to query Google?
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Post by pentapenguin »

Nope, as you can see on the demo, you're not on Google at all.
In fact, if you wanted to, you could remove all references to Google, and it would look like your own search engine.
Pretty slick IMHO. ;)
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
MIS-ONE
Registered User
Posts: 82
Joined: Tue Dec 24, 2002 9:21 pm

Post by MIS-ONE »

I applaud this creation. Worked flawlessly for me running 2.14 on a heavily modded board.

How hard would it be to get this to work in overall header?
Rapid Dr3am
Registered User
Posts: 198
Joined: Sun Jul 13, 2003 4:14 pm
Location: Incommunicado
Contact:

Post by Rapid Dr3am »

Will this work with google adsense search?
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Contact:

Post by deny »

Rapid Dr3am wrote: Will this work with google adsense search?


YOu forget that Adsense TOS said place code exactly as it is.
Rapid Dr3am
Registered User
Posts: 198
Joined: Sun Jul 13, 2003 4:14 pm
Location: Incommunicado
Contact:

Post by Rapid Dr3am »

But the adsense default search code is not valid XHMTL 1.0 so I must edit it. :roll:
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Post by pentapenguin »

MIS-ONE wrote: How hard would it be to get this to work in overall header?

Thanks! :)
Not very hard--what style are you using?
(Link if it's rare please.)

Rapid Dr3am, is this what you mean?
I don't use AdSense so I can't say for sure, but I don't think so because you are on Google when you preform that search instead of your own website.
However, I don't see any problem with just adding your AdSense code in google_search_results.tpl
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
MIS-ONE
Registered User
Posts: 82
Joined: Tue Dec 24, 2002 9:21 pm

Post by MIS-ONE »

pentapenguin wrote: How hard would it be to get this to work in overall
Not very hard--what style are you using?
(Link if it's rare please.)


just subSilver, nothing fancy at all! thanks!
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Post by pentapenguin »

Sorry, I forgot to ask, where do you want it?
Below the Profile, PMs, and Log in/out links?

Two releated things:
1. Yahoo offers a similar feature to the Google API so I'll make a MOD for that soon.
2. Version 0.2.0 (hopefully out soon) will get around the only 10 results a page limitation. ;)
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
MIS-ONE
Registered User
Posts: 82
Joined: Tue Dec 24, 2002 9:21 pm

Post by MIS-ONE »

pentapenguin wrote: Sorry, I forgot to ask, where do you want it?
Below the Profile, PMs, and Log in/out links?


sure, that'd be great. really anywhere, I'm not picky at all.
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Contact:

Post by deny »

Rapid Dr3am wrote: But the adsense default search code is not valid XHMTL 1.0 so I must edit it. :roll:



If i'm you then i'll contact google for sure because of TOS:

Code Modification
Any AdSense ad code or search box code must be pasted directly into Web pages without modification. AdSense participants are not allowed to alter the ad code for any reason, include changing the ad layout, behavior, or delivery of ads.
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Post by pentapenguin »

MIS-ONE, I'll get you the code later tonight.

deny, I really don't know anything about AdSense since I don't use it so please refer all questions about it to Google--thanks! ;)
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
jeter4982
Registered User
Posts: 6
Joined: Fri Apr 08, 2005 2:54 am

Post by jeter4982 »

Any update on when version 2 will be released?

I can't wait.

Thanks,

Tom
User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit »

pentapenguin wrote: Nope, as you can see on the demo, you're not on Google at all.
In fact, if you wanted to, you could remove all references to Google, and it would look like your own search engine.
Pretty slick IMHO. ;)


Ah, very cool! :)
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."
Post Reply

Return to “[2.0.x] MODs in Development”