Ravens PHP Scripts: Forums


View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks
Author Message

Joined: Nov 19, 2003
Posts: 282

PostPosted: Tue Mar 10, 2009 12:54 pm Reply with quote

I'm not literate enough.


  copyright (c) 2009 google inc.

  You are free to copy and use this sample.
  License can be found here: http://code.google.com/apis/ajaxsearch/faq/#license

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google AJAX Search API Sample</title>
    <script src="http://www.google.com/jsapi?key=<<INSERT KEY>>"></script>
    <script type="text/javascript">
    *  How to do a search that returns the max number of results per page.
    google.load('search', '1');
    function OnLoad() {
      // create a search control
      var searchControl = new google.search.SearchControl();
      // Set the Search Control to get the most number of results
      // Create 2 searchers and add them to the control
      searchControl.addSearcher(new google.search.WebSearch());
      searchControl.addSearcher(new google.search.BlogSearch());
      // Set the options to draw the control in tabbed mode
      var drawOptions = new google.search.DrawOptions();
      // Draw the control onto the page
      searchControl.draw(document.getElementById("content"), drawOptions);
      // Search!
      searchControl.execute("Subaru STI");
  <body style="font-family: Arial;border: 0 none;">
    <div id="content">Loading...</div>

I tried putting the javascript in the javascript.php and converted the html to a block but when I loaded the block the site would not load. Blank screen.

Now I assumed it should be that simple but as Im not that literate ... obviously its not .... LOL Smile
View user's profile Send private message

Joined: Jan 17, 2009
Posts: 272
Location: Missouri

PostPosted: Wed Mar 11, 2009 4:40 am Reply with quote

Simple way to do this would be using iframes. Im also not that literate, but with iframes anything is possible.

Create a new folder, lets say Google, and save the code you posted as index1.html, next create a blank file called index.html, now create an index.php and add the following:


$module_name = basename(dirname(__FILE__));
$index = 0;
echo"<IFRAME src=\"/modules/Google/index1.html\" width=\"800\" height=\"1200\">"
  . "<p>Your browser doesn't support frames. Click <a href=\"http://ThePageYourIncluding.com\" target=\"_blank\">here</a> to view the page.</p>"
  . "</IFRAME>";


So in the Google folder youll have 3 files, index.html index1.html and index.php. Now just change the settings in the above etc, dont forget your google api key in the index1...save and upload. The blank index is to prevent access to the modules dir.
View user's profile Send private message

PostPosted: Fri Mar 13, 2009 3:25 pm Reply with quote

Thanks horrorcode - I will go and try to make this work this evening Smile
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum

Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
Forums ©