Previous Thread
Next Thread
Print Thread
Hop To
Displaying Google Search Results #213602 05/28/2008 5:19 PM
Joined: Nov 2004
Posts: 173
luket Offline OP
enthusiast
OP Offline
enthusiast
Joined: Nov 2004
Posts: 173
I use Google “AdSense for Search” to place a Google Search bar on my message board. This works well for searching large message boards very quickly. (I’ve been using it for years now.)

Google offers several options for displaying the output; the one I use is the option to output search results in one of my own pages. This is preferred because the output will be displayed on a page that has the look and feel of the rest of my site; links to the forums, etc.

The problem is that I’ve not found a nice way to do this since moving to threads from classic. I know you can place the results in HTML, PHP, etc.. because I do it on other sites. On this site, I place the output in a rather ugly static HTML page that doesn’t accurately represent my current web site.

My question is this: How can I have an output region (HTML or PHP) that resides in a construct that looks like my portal page?

Below you wil see my message board complete with the Google Search in the upper right. You will notice the large blank area where I have added a comment. That’s what you get when you use that little gold arrow to hide the forums within a master forum.
This is really the look I’m going for .. how can I write to that big blank area?

[Linked Image from game-master.net]

I’m not married to this particular idea, but I’d like to have a living display area that reflects any changes we make to the board in the way of links, islands, etc..
Ideas? Solutions? Suggestions?


Member since November 2004
Gold Member since Feb 2008
Re: Displaying Google Search Results [Re: luket] #213603 05/28/2008 5:52 PM
Joined: Apr 2007
Posts: 3,938
SD Offline
Former Developer
Offline
Former Developer
Joined: Apr 2007
Posts: 3,938
Google Ajax search API would allow you to do what you want. smile

Re: Displaying Google Search Results [Re: SD] #213604 05/28/2008 6:43 PM
Joined: Nov 2004
Posts: 173
luket Offline OP
enthusiast
OP Offline
enthusiast
Joined: Nov 2004
Posts: 173
I'm not sure I understand your reply... I don't have a problem with the search, it's the display of the results I'm trying to resolve.

How would Google Ajax search API solve *that* problem?


Member since November 2004
Gold Member since Feb 2008
Re: Displaying Google Search Results [Re: luket] #213607 05/28/2008 6:53 PM
Joined: Apr 2007
Posts: 3,938
SD Offline
Former Developer
Offline
Former Developer
Joined: Apr 2007
Posts: 3,938
you'd have a div where the results would be displayed to. you can fully style the returned results (either json or xml or html), so it 'fits in' with your current style..

eg:

Code
// web search, open, alternate root
var options = new GsearcherOptions();
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
options.setRoot(document.getElementById("your_search_results_div"));
searchControl.addSearcher(new GwebSearch(), options);

returned results have the following format (note the css):

HTML
<!-- A collection of web search results in the search control -->
<div class="gsc-results gsc-webResult">

  <!-- A single web result in the search control -->
  <div class="gsc-result gsc-webResult">

    <!-- A single web result, full structure defined below -->
    <div class="gs-result gs-webResult"></div>
  </div>
  ...
</div>

<!-- Similar pattern for local, blog, etc. -->
<div class="gsc-results gsc-localResult"></div>
<div class="gsc-results gsc-blogResult"></div>
  

then your style sheet (extra css section) would have those classes defined and *poof* done..

note: it requires a Google API key (free)

holy moley, i just noticed i'm a 'Pooh Bah' now eek

ps: note '*poof* done' doesn't imply it's as simple as the snippets i pasted.. there's a wee bit more to it, but it's doable wink

Re: Displaying Google Search Results [Re: SD] #213608 05/28/2008 7:45 PM
Joined: Nov 2004
Posts: 173
luket Offline OP
enthusiast
OP Offline
enthusiast
Joined: Nov 2004
Posts: 173
Super.. and congrats on your Pooh Bah'ness laugh

Now.. What file do I insert the results code into to get it to display as shown above?


Member since November 2004
Gold Member since Feb 2008
Re: Displaying Google Search Results [Re: luket] #213610 05/28/2008 8:35 PM
Joined: Apr 2007
Posts: 3,938
SD Offline
Former Developer
Offline
Former Developer
Joined: Apr 2007
Posts: 3,938
well.. i guess you want search results and the search box to be on all screens ?

what i'd do is add the div right after the opening body tag and set it's inline style to style="display:none; z-index:10000;" also class="search_results_div" kinda dealio..

so it's hidden all of the time.. (until needed)

your extra css section styles the search_results_div to (when it becomes visible) to appear in the middle and the z-index allows it to overlay anything 'underneath' ...

then your ajax (javascript) crapola would do a .show / .hide (appear/fade if you wanna do scriptaculous stuff).. and then invoke the Google API stuff to fill it up..

... soo since it's right after the opening body tag, the file would be header.tpl wink -- forgot to mention it laugh

ps: here is an example of how they did it.. same idea.. just different styles Linky Poo™

Documentation is here

Re: Displaying Google Search Results [Re: SD] #213643 05/29/2008 10:52 AM
Joined: Nov 2004
Posts: 173
luket Offline OP
enthusiast
OP Offline
enthusiast
Joined: Nov 2004
Posts: 173
there we go!
thank you your poo-bah'ness


Member since November 2004
Gold Member since Feb 2008

Link Copied to Clipboard
Forum Search
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Subscriptions Question
by Ruben - 01/14/2020 12:11 PM
Page won't load after 7.7.3 Update
by Jim0421 - 01/08/2020 11:11 AM
Ubb 7.7.3 winkey emoji shortcut issue
by Ruben - 01/07/2020 4:04 PM
testing winkey emoji shortcut
by Ruben - 01/06/2020 2:36 PM
Very strange problem
by Baldeagle - 01/05/2020 1:22 PM
Who's Online Now
0 members (), 56 guests, and 363 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Amusing Terain Scenics
Amusing Terain Scenics
by isaac, August 19
Sky places
Sky places
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Snapshot build 20200106)