Google Ajax API Block
The Google AJAX Search API lets you put Google Search in your web pages with JavaScript. You can embed a simple, dynamic search box and display search results in your own web pages or use the results in innovative, programmatic ways.
Using an AJAX API Key
The Google AJAX Search API lets you put Google Search in your web pages with JavaScript. You do not need a key to use this API. Using a key in your application/site is completely optional. However, it is useful to have one. Here is why – when a key is present, if we detect any problem or issue that involves your application/site, with a key in hand, we will attempt to contact you. If we do not have a key, we have no way to contact you should something go wrong.
If you are ready, go ahead and sign up for an API key
What will this block do?
The Google Ajax Search block is coded specifically for PHPNuke and will show in real time what you type in the search box and reveal search results in real time as soon as you start typing it will start pulling in results for the letters and words you type. It is designed so it will search Google and another site of your choice.
Preview it working
This is a short screen cast of the block in action on a local server.
Installation
- If you want the option to search from yoursite as well as Google, then you will need a Google API key which is free and can be obtained from the Google API site.
- Once you have the API key, open the block called block-Ajax_Google_Search.php and enter your API key in the $key variable at the top.
- Whilst you have the block open you may also see a variable called $themecolor this is for your themes colour so the stlye css matches, if you use a dark theme set the variable to true and if you use a light theme set it to false
- If you do not want people to search from yoursite then you can skip the first step and leave the API key alone (you do not need an API key for it to work)
Troubleshooting
- The block by default is set to a fixed width of 180 pixels, if your PHPNuke blocks are not as wide as 180 pixels and you find the block pushing them apart you can rectify this by opening the 2 .css files in the includes folder in a decent text editor (CTRL+F to search a file) for 180 and change it to your desired width (there are 3 references in each .css sheet)
Want to learn more?
If you want to lean more about the Google Ajax API and what add-ons you can make, then head on over the the Google Ajax API site.
Download the PHPNuke Source Code
You can download the Google Ajax API PHPNuke Block (no registration required)





