Skip to content

Instantly share code, notes, and snippets.

@dwheeler
Created May 19, 2011 22:00
Show Gist options
  • Save dwheeler/981886 to your computer and use it in GitHub Desktop.
Save dwheeler/981886 to your computer and use it in GitHub Desktop.
Simple php file to show google in an iframe in SugarCRM.
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
?>
<iframe id="scGoogleSearch" src="http://www.google.com" width="750" height="400"></iframe>
<script>
//Encapsulate the call to protect the global scope.
(function(){
var name = document.getElementById("name") || document.getElementById("full_name");
var frame = document.getElementById("scGoogleSearch");
var url = "http://www.google.com/#";
if (name != null)
{
if (typeof(name.value) == "string")
{
url += "q=" + name.value;
}
else
{
url += "q=" + name.innerText;
}
}
frame.src=url;
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment