Archive for April, 2008

Google Custom Search for Joomla

Sunday, April 6th, 2008

To enable your joomla site with Google Custom Search is easy – but it requires some details that described in this document.

1. Create a Google Custom Search account

* http://www.google.com/coop/cse/

2. Create a static content page to display the search result.

Copy the search result code from Google Custom Search Engine Page.

<!– Google Search Result Snippet Begins –>
<div id=”cse-search-results”></div>
<script type=”text/javascript”>
var googleSearchIframeName = “cse-search-results”;
var googleSearchFormName = “cse-search-box”;
var googleSearchFrameWidth = 580;
var googleSearchFrameborder = 0;
var googleSearchDomain = “www.google.com“;
var googleSearchPath = “/cse”;
</script>
<script type=”text/javascript” src=”http://www.google.com/afsonline/show_afs_search.js”></script>
<!– Google Search Result Snippet Ends –>

3. Create the Google Custom Search box on your site. There are many ways to put the search box code to your site. I have choosen the jumi module to create my search box.

Pay attention to the action url, and the hidden fields

<!– Google CSE Search Box Begins –>
<form action=”http://www.rosterchan.com/cms/index.php” id=”cse-search-box”>
<input type=”hidden” name=”cx” value=”017670683912109064910:9y-xh1dpj3k” />
<input type=”hidden” name=”option” value=”com_content”>
<input type=”hidden” name=”task” value=”view”>
<input type=”hidden” name=”id” value=”3″>
<input type=”hidden” name=”Itemid” value=””>
<input type=”hidden” name=”cof” value=”FORID:11″ />
<input type=”text” name=”q” size=”25″ />
<input type=”submit” name=”sa” value=”Search” />
</form>
<script type=”text/javascript” src=”http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en”></script>
<!– Google CSE Search Box Ends –>