Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Default Search Capabilities in DotNetNuke 4.9.3Default Search Capabilities in DotNetNuke 4.9.3
Previous
 
Next
New Post
6/24/2009 11:23 AM
 

Took the code off the following link after a response on www.dotnetnuke.com forums:

http://weaselfire.wordpress.com/2009/06/17/google-custom-search-for-dotnetnuke/#comment-7

I got my Google API, added a TEXT/HTML module and then cut and pasted with the appropriate website URL edits only to get the folllowing error:

Line: 552
Char: 1
Error: ‘google.search.SearchControl’ is null or not an object
Code:0
URL:

I am using IE7 and added the new TEXT/HTML module to the existing DNN search results page. The search box is rendered but I get the yellow error box in the bottom left corner of IE. When I type a search string, the keyboard does not respond to the RETURN key to start the search. Any ideas...I like the idea of the code and the ability to search documents in the portal... I also tried it on a dedicated DNN webpage with the same error....here is the page.... :

http://www.insidertech.co.uk/GoogleSearch/tabid/199/Default.aspx

And here is my amended code I am using :

<script src="http://www.google.com/jsapi?
key=ABQIAAAALgmUPRveB57J3cnHdwLwMhTLsVmvth3u1C1qO3eoCMoX_mXkHhQuG7ZvjZm9rAR-jg3RXjAMIl3e1g"
type="text/javascript"></script><script language="Javascript" type="text/javascript">
//  Script based on a blog post at:
//  http://www.eguanasolutions.com/DNN_Blog/EntryID/7.aspx
<!--    google.load('search', '1.0');
function checkKeypress(e)
{
var kC  = (window.event) ? event.keyCode : e.keyCode;
var Esc = (window.event) ? 27 : e.DOM_VK_ESCAPE;
if (kC == Esc) {  event.keyCode=13;  return;  }
if (kC == 13) return false;
return kC;
}

function OnLoad()
{
var searchControl = new google.search.SearchControl();
var drawOptions = new google.search.DrawOptions();
drawOptions.setInput(document.getElementById("gss_input"));
var options = new google.search.SearcherOptions();
options.setExpandMode
  (google.search.SearchControl.EXPAND_MODE_OPEN);
options.setRoot(document.getElementById("gcsResults"));
searchControl.setResultSetSize
  (google.search.Search.SMALL_RESULTSET);
// Set up a site search - searches the web site pages
var siteSearch = new google.search.WebSearch();
// Replace the site root with your own site URL
siteSearch.setSiteRestriction("http://www.insidertech.co.uk/");
//  We're only including "aspx" pages from our site.
//  We're specifically excluding "LinkClick" page links
//  (links with "fileticket")
siteSearch.setQueryAddition("+filetype:aspx -fileticket");
siteSearch.setUserDefinedLabel("Web Pages:  ");
searchControl.addSearcher(siteSearch, options);
//  Configure a search of physical files available
//  for download
var fileSearch = new google.search.WebSearch();
//  Replace with your own URL, portal and folder
//  with the files to be searched
fileSearch.setSiteRestriction
  ("http://www.insidertech.co.uk/Portals/0");
fileSearch.setQueryAddition("-filetype:aspx");
fileSearch.setUserDefinedLabel("Files:  ");
searchControl.addSearcher(fileSearch, options);
searchControl.draw(null, drawOptions);
}
google.setOnLoadCallback(OnLoad, true);
-->
</script>
<div>
<p>To search all of www.insidertech.co.uk for words, phrases and documents, enter a search term below:</p>
<input onkeypress="return checkKeypress(event)" id="gss_input" onfocus="if (this.value==this.defaultValue)
this.value='';" size="80" value="Search Now" type="text" /></div>
<div id="branding">&#160;</div>
<div id="gcsResults">&#160;</div>

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Default Search Capabilities in DotNetNuke 4.9.3Default Search Capabilities in DotNetNuke 4.9.3


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out