De búsqueda de Google en mi sitio?

  • Tone2k11
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Mar 14, 2004
  • Mensajes: 494
  • Loc: Southampton - UK
  • Status: Offline

Nota Marzo 15th, 2004, 12:39 am

Hola a todos,

Im nuevo a webbuilding y estoy tratando de obtener una búsqueda de google en mi sitio? es esto posible? si es así como nadie tiene el código para ello?

I appriciate que takin el tiempo para leer esto.

Gracias de antemano

Tony :D
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Marzo 15th, 2004, 12:39 am

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Registrado: Feb 10, 2004
  • Mensajes: 13455
  • Loc: Florida
  • Status: Offline

Nota Marzo 15th, 2004, 10:48 pm

Es esto lo que buscabas?
http://www.google.com/apis/


O bien, esto popup una nueva ventana con los resultados de Google.
Código: [ Select ]
<html>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function askGoogle(query){
    googleAdr = "http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=";
    queryFull = googleAdr + query;
    window.open(queryFull,"_BLANK");
}
// -->
</SCRIPT>
</HEAD>

<body>
<input type="text" id="terms">
<input type="button" value="Ask Google" onclick="askGoogle(terms.value);">


</body>
</html>
  1. <html>
  2. <HEAD>
  3. <SCRIPT LANGUAGE="JavaScript">
  4. <!--
  5. function askGoogle(query){
  6.     googleAdr = "http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=";
  7.     queryFull = googleAdr + query;
  8.     window.open(queryFull,"_BLANK");
  9. }
  10. // -->
  11. </SCRIPT>
  12. </HEAD>
  13. <body>
  14. <input type="text" id="terms">
  15. <input type="button" value="Ask Google" onclick="askGoogle(terms.value);">
  16. </body>
  17. </html>
Strong with this one, the sudo is.
  • Smilingwolf
  • Novice
  • Novice
  • Avatar de Usuario
  • Registrado: Dic 03, 2003
  • Mensajes: 31
  • Status: Offline

Nota Marzo 21st, 2004, 7:45 pm

He añadido una búsqueda de google a mi sitio y que necesita una clave que se facilita de google. Se le da permiso para hacer 1000 búsquedas por día. He utilizado un módulo para XOOPS para hacer esto.
  • Scorpius
  • Proficient
  • Proficient
  • Avatar de Usuario
  • Registrado: Mar 20, 2004
  • Mensajes: 401
  • Loc: Scorpion Hole
  • Status: Offline

Nota Marzo 22nd, 2004, 1:00 am

Bueno, ya que pidió que tomé un poco de tiempo y de hecho este...
Sólo hay que poner esta parte en el encabezado de su página de búsqueda:
Código: [ Select ]
<script type="text/javascript">
function googleload()
{
document.f.submit()
}
</script>
  1. <script type="text/javascript">
  2. function googleload()
  3. {
  4. document.f.submit()
  5. }
  6. </script>

Entonces, usted necesitará una sentencia if para saber si el formulario no se ha presentado así, poner algo como esto:
Código: [ Select ]
<? if(isset($_GET[q])) {
$url = "yoursite.com";?>
<body bgcolor=white onload="load()">
yea this is sc0rp.ath.cx
<form action="http://www.google.com/search" name=f>
<table cellspacing=0 cellpadding=0>
 <tr>
  <td width=75>&nbsp;</td>
  <td align=center>
    <input type=hidden name=hl value=en>
    <span id=hf></span>
    <input type=hidden name=ie value="UTF-8">
    <input type=hidden name=oe value="UTF-8">
    <input maxLength=256 size=55 name=q value="<? echo "site:$url $_GET[q]"; ?>">
    <br><input type=submit value="Google Search" name=btnG>
    </td></tr></table></form>
  1. <? if(isset($_GET[q])) {
  2. $url = "yoursite.com";?>
  3. <body bgcolor=white onload="load()">
  4. yea this is sc0rp.ath.cx
  5. <form action="http://www.google.com/search" name=f>
  6. <table cellspacing=0 cellpadding=0>
  7.  <tr>
  8.   <td width=75>&nbsp;</td>
  9.   <td align=center>
  10.     <input type=hidden name=hl value=en>
  11.     <span id=hf></span>
  12.     <input type=hidden name=ie value="UTF-8">
  13.     <input type=hidden name=oe value="UTF-8">
  14.     <input maxLength=256 size=55 name=q value="<? echo "site:$url $_GET[q]"; ?>">
  15.     <br><input type=submit value="Google Search" name=btnG>
  16.     </td></tr></table></form>

Entonces se necesitará la forma en que regularmente se presenta, esto podría estar en otro también, y entonces sí sería necesario si la declaración anterior, pero se necesitaría todo el código de otros.
Código: [ Select ]
<? } else { ?>
<body bgcolor="white">
<form action="<?=$PHP_SELF?>" name=f>
<table cellspacing=0 cellpadding=0>
 <tr>
  <td width=75>&nbsp;</td>
  <td align=center>
    <input type=hidden name=hl value=en>
    <span id=hf></span>
    <input type=hidden name=ie value="UTF-8">
    <input type=hidden name=oe value="UTF-8">
    <input maxLength=256 size=55 name=q value="">
    <br><input type=submit value="Google Search" name=btnG>
    </td></tr></table></form>
<? } ?>
  1. <? } else { ?>
  2. <body bgcolor="white">
  3. <form action="<?=$PHP_SELF?>" name=f>
  4. <table cellspacing=0 cellpadding=0>
  5.  <tr>
  6.   <td width=75>&nbsp;</td>
  7.   <td align=center>
  8.     <input type=hidden name=hl value=en>
  9.     <span id=hf></span>
  10.     <input type=hidden name=ie value="UTF-8">
  11.     <input type=hidden name=oe value="UTF-8">
  12.     <input maxLength=256 size=55 name=q value="">
  13.     <br><input type=submit value="Google Search" name=btnG>
  14.     </td></tr></table></form>
  15. <? } ?>

He probado esto en mi primer servidor y parece que ha funcionado muy bien, simplemente cambia la variable $ url en su sitio. Si usted tiene algún problema, puede IM mí en casi cualquier mensajero, o PM me.

Publicar Información

  • Total de mensajes en este tema: 4 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 110 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC