Páginas: [1]
|
 |
|
Autor
|
Tema: Buscador interno en html (Leído 1934 veces)
|
¤ Nerviozzo ¤
Desconectado
Mensajes: 3.960
[*_*]RAP SOLO[*_*]
|
Pues eso, que me gustaria ponerle un buscador interno a mi web, a ser posible en html, mas bien parecido al de: http://www.elmejorwarez.org/principal.php , el de arriba del todo PD:Ya busque en el foro pero no encuentro lo que yo quiero
|
|
|
|
|
En línea
|
|
|
|
Rentero
Colaborador
Desconectado
Mensajes: 1.155
La paciencia es la madre de la ciencia.
|
Bueno pues si no me equivoco en html no se puede, si te fijas en esa pagina tambien está en php, seguramente pporque tambien usen base de datos...
|
|
|
|
|
En línea
|
Firmado.
|
|
|
-Riven-Ward-
RivenSoft
Desconectado
Mensajes: 2.219
Do you like Mario? xDDDDDDDDDDDD
|
Justo hoy hize un buscador, pero en PHP  ... Te lo pongo porsiacaso Primero creas el archivo conexion.php (el que contendrá la conexión a la base de datos: <?php $conexion = mysql_connect("localhost","user","password"); mysql_select_db ("base_de_datos", $conexion) OR die ("La base de datos esta inaccesible, o no existe"); ?> Luego creas buscador.php , el buscador: <?php if (isset ($buscar)) { $palabra = htmlentities ($palabra); $palabra = htmlspecialchars ($palabra); include ("conexion.php"); $sql = "SELECT * FROM ".$tabla." WHERE nombre LIKE '%".$palabra."%'"; $resp = mysql_query ($sql); if (mysql_fetch_array ($resp) <= 0) { echo "No se encontraron resultados con el termino ".$palabra.":(."; } else { include ("conexion.php"); $sql = "SELECT * FROM ".$tabla." WHERE nombre LIKE '%".$palabra."%'"; $resp = mysql_query ($sql); while ($row = mysql_fetch_array ($resp)) { echo "Nombre: ".$row ["nombre"]."<br>"; } } } else { ?> <form action="<? $PHP_SELF ?>" method="post"> Introduce el termino a buscar: <input type="text" name="palabra"><br> En que sector deseas buscar? <select name="tabla"> <option value="articulos">Artículos</option> <option value="manuales">Manuales</option> </select> <br><br> <input type="submit" name="buscar"> </form> <?php } ?> Bueno esa es una pequeña idea, tu debes poner las tablas que tienes, y todo eso... Espero que te sirva...  Salu2!
|
|
|
|
« Última modificación: 28 Mayo 2004, 10:30 por -Riven-Ward- »
|
En línea
|
Usuario Banneado
|
|
|
|
|
|
|
|
Cobac
|
yo una vez vi uno que estaba realizado en javascript, eso si era un palizon tener que ir añadiendo nuevas cosas a la "base de datos"
si te interesa lo empiezo a buscar (aunque no se si lo encontraré), al menos que sepas que existe xD
salu2
|
|
|
|
|
En línea
|
PIV 2533 @ 2720Mhz | 512MB DRR333 @ 358 | 160 Gb + 40 Gb Seagate Barracuda
En la Edad Media la Iglesia robaba con los diezmos. En el siglo XXI la SGAE roba con sus cánones.
|
|
|
¤ Nerviozzo ¤
Desconectado
Mensajes: 3.960
[*_*]RAP SOLO[*_*]
|
No se, siquieres  , tendre que buscar uno bueno 
|
|
|
|
|
En línea
|
|
|
|
|
|
|
|
¤ Nerviozzo ¤
Desconectado
Mensajes: 3.960
[*_*]RAP SOLO[*_*]
|
Bueno intentare usar el javascrip indexer ese El link esta roto
|
|
|
|
|
En línea
|
|
|
|
|
Azielito
|
Bueno intentare usar el javascrip indexer ese El link esta roto Ami si me abre :s
JavaScript Indexer and Search Engine Description:On servers which don't admit server-side scripts (PHP/ASP/etc..) if you wish to add a search engine you have 2 options: -To use a dedicated external engine. -Or to use a script that runs on client side. The second option has the advantage that you can use the search engine offline (on html help, tutorials, etc..). JavaScripts cannot search through directories on the server, so you must make a file which contains a database with the words you like to be searched for. I made a console program (JavaScript Indexer) which scans a specified directory and all subdirectories for "*.htm*" and "*.txt" files and automatically indexes the web site, creating a database on a js file. It writes the search function into the same file. So all you have to do is to add few lines to the web page and you have your search engine running. These lines are: Add this line in the HEAD section of the html (just after <HEAD>): <script language="JavaScript" type="text/javascript" SRC="search.js"></script>
And these lines where you want to add the input box: <form name="JF1" action="javascript:FND(document.JF1.JT1.value)"> <input type="text" name="JT1" size=25> <input type="submit" value="Search!"> </form> You can paste this code into your page. The ".js" file is the file created by the program. This file must be added on server. Sample:You can test it on my page. Type a common word on the input box on the top of the page and click the Search! button or press Enter. To see multiframe example click here. For a sitemap generated from database click here. Requirements and compatibility: Microsoft Windows 9x, NT, Me, 2000, XP for jsind.exe The script theoretically works with these browsers: Internet Explorer 4 to 6 Netscape Navigator 4 to 7 But the the reality is different. It was tested with these browsers:  Same window, new window or Multiframe window is the window which will display the search results. Screenshot: Performance: The main drawback is that the program is slow with big files. A 150k file containing a big table is processed in up to 20 seconds. In return the script runs faster with fewer big files. A database of 550 pages and 3.5MB is searched in approx. 40-60 seconds. An average web site is searched in maximum 5-10 seconds. For small sites (smaller then 25 pages) and low speed connections this engine is faster then a PHP/ASP version because the database is loaded with the page and the engine generates the result on the client browser. The search speed is processor power dependent. The information above is obtained on my old AMD K6-2@500MHz. On a faster PC the search speed is greater. Customization:You can customize the look of the generated result page by editing the default.inc which comes with the program or by creating another inc file and by editing the jsind.ini. License:This program is FREEWARE.
Despues vienen purascosas raras XD Download: jsind.zip - 81k jsind-src.zip - 12k Delphi 6 source files
|
|
|
|
|
En línea
|
|
|
|
¤ Nerviozzo ¤
Desconectado
Mensajes: 3.960
[*_*]RAP SOLO[*_*]
|
??? Bueno... si tu lo dices 
|
|
|
|
|
En línea
|
|
|
|
|
Cobac
|
buscando he encontrado el de js, que lo publiqué hace mucho, mucho tiempo xDD Bueno si haces la web en html, tengo esto en javascript, tienes que poner una base de datos con todo lo k tengas, ya veras k te lo pego todo: Un archivo html con lo siguiente:<html> <head> <title>Buscador</title> <script language="Javascript" src="xsearch-5.2.js"></script> <script language="Javascript" src="db.js"></script> <body bgColor="#ffffff"> <script language="Javascript"> initXsearch(); </script> </body> </html>Un archivo llamado xsearch-5.2.js con lo siguiente: function trecords(){ this.index=(trecords.count++) this.link='' this.keywords='' this.description='' return this } trecords.prototype.set=function(link,keywords,description) { this.link=link this.keywords=keywords this.description=description } trecords.prototype.searchstring=function() { return this.link+' '+this.keywords+' '+this.description } trecords.prototype.count=0
function add(link,keywords,description) { al=records.length records[al]=new trecords() records[al].set(link,keywords,description) }
records = new Array() finds=0 sites=0 version="v5.2" andresult=false SortResults=true display_start=0 displast=10 function qsort(f, l){ // not used anymore, causes stack-overflow in large database // Qsort function by Rob B. var a=f var b=l var s var m = results[(a+b)>>1].val while (a<=b) { while (results[a].val>m) {a++} while (m>results.val) {b--}
if (a<=b) { s=results[a] results[a]=results results=s a++ b-- } } if (f<b) this.qsort(f, b) if (a<l) this.qsort(a, l) } function bsort() { for (var i=results.length-1; i>=0; i--) { for (var j=i; j>=0; j--) { if (results.val>results[j].val) { s=results results=results[j] results[j]=s } } } }
function searchAll(keyword){ var timeA=new Date() var nw=0 finds=0 sites=0
var x = parseIt(keyword) if(x == -1) return total_keywords=x
document.open() document.clear() document.write('<link rel="stylesheet" href="xsearch.css">') AddBody()
if (keyword.length>50) keyword=keyword.substring(0,60)+"..."
results=new Array() for (q=0; q<records.length; q++) { results[q]=new Array() results[q].rec=q results[q].val=0 }
for (nw=0; nw<keywords.length; nw+=1) search(keywords[nw]) if (andresult) { for (a=0; a<results.length; a+=1) { if (results[a].val>0) { if (results[a].val<=(total_keywords-1)<<1) { results[a].val=0 sites-=1 } } } } if (SortResults && keywords!='[all]') bsort()
// Now we build the output page displast=display_start displast+=10 if (displast>sites) displast=sites
var timeB=new Date()
if (finds==0) { display_start=-1; displast=0 } document.write("<center><h3>Resultados <b>"+(display_start+1)+"-"+(displast)+"</b> de <b>"+sites+"</b> para <b>"+keyword+"</b> Tiempo de búsqueda <b>"+((timeB-timeA)/1000)+"</b> segundos.</h3></center>")
if (displast>sites && finds!=0) displast=sites+1
if (finds==0) { document.write("<h3><font color=green>no se encontró <b>''"+keyword+"''</b></font></h3>"+ "<p>La palabra - <b>"+keyword+"</b> - no se encuentra en la base de datos.</p>"+ "<LI>Verifique que haya deletreado bien la palabra.</li>"+ "<LI>Intente nuevamente utilizando otra palabra clave.</li>"+ "<LI>Pruebe ingresando varias palabras en un mismo campo.</li></span>"+ "</p>") DisplayXSearch() document.close() return }
q2=display_start q3=displast for (q=display_start; q<q3; q+=1) { if (results[q].val>0) { rc=results[q].rec document.write("<span class='xtitle'>"+records[rc].link+"</span><br>") x1=records[rc].link.indexOf('http://') if (x1==-1) x1=records[rc].link.indexOf('href=')+5 else x1+=7 x2=records[rc].link.indexOf('>')-1 if (x1>0 && x2>0) { tmp=records[rc].link.substring(x1,x2) x2=tmp.indexOf(' ') if (x2>0) tmp=tmp.substring(0,x2) if (tmp.substring(0,1)=="'") tmp=tmp.substring(1,tmp.length-2) if (tmp.substring(0,1)=='"') tmp=tmp.substring(1,tmp.length-1) document.write("<table border=0 width=500><tr><td><span class='xresult'>"+records[rc].description+"</span></td></tr></table><span class='xlocation'>"+tmp+"</span><br><br>") } q2++ } }
if (finds>10) { document.write("<BR>") pages=Math.round(finds/10) if (finds%10<6) pages++
// Create the parameter string paramstring=searchname+"?keywords="+keyword+"&and="+andresult+"&sort="+SortResults
document.write("<center><span class='xsmall'>") if (display_start>0) document.write("<a href='"+paramstring+"&disp="+(display_start-10)+"'>anterior</a>") document.write(" ")
for (i=1; i<=pages; i+=1){ if ((((i-1)*10)+1)<=sites) document.write("<a href='"+paramstring+"&disp="+(((i-1)*10))+"'>"+i+"</a>   ") } document.write(" ") if (displast<=sites) document.write("<a href='"+paramstring+"&disp="+(displast)+"'>siguiente</a>") document.write("</span></center>") } DisplayXSearch() document.close() }
function Cat() { document.open() document.clear() document.write('<link rel="stylesheet" href="xsearch.css">') AddBody() DisplayXSearch() document.close() }
function stripInput(key) { while(key.substring(0,1) == "," || key.substring(0,1) == " " ) key = key.substring(1,key.length) while(key.substring(key.length-1,key.length) == "," || key.substring(key.length-1,key.length) == " ") key = key.substring(0,key.length-1) return key }
function parseIt(key) { key=stripInput(key)+" " var y=0
while(key.indexOf(" ") > 0) { if (key.substring(0,1)=='"') { var pos=key.indexOf('"',2) keywords[y]=key.substring(1,pos) keywords[y]=stripInput(keywords[y]) y++ key=key.substring(pos+1,key.length) } else { var pos=key.indexOf(' AND ') if ((pos>0) && (key.indexOf(' ')>=pos)) { pos=key.indexOf(' ',pos+5) keywords[y]=key.substring(0,pos) keywords[y]=stripInput(keywords[y]) y++ key=key.substring(pos+1,key.length) if (key.substring(0,4)=='AND ') { pos=keywords[y-1].indexOf(' ')+5 key=keywords[y-1].substring(pos,keywords[y-1].length)+' '+key } } else { var pos=key.indexOf(' OR ') if ((pos>0) && (key.indexOf(' ')>=pos)) { pos=key.indexOf(' ') keywords[y]=key.substring(0,pos) keywords[y]=stripInput(keywords[y]) if (keywords[y]!=keywords[y-1]) y++ key=key.substring(pos+1,key.length) pos=key.indexOf('OR ') key=key.substring(pos+3,key.length) pos=key.indexOf(' ') keywords[y]=key.substring(0,pos) keywords[y]=stripInput(keywords[y]) y++ key=key.substring(pos+1,key.length) if (key.substring(0,3)=='OR ') key=keywords[y-1]+' '+key } else { var pos = key.indexOf(" ") keywords[y]=key.substring(0,pos) keywords[y] = stripInput(keywords[y]) y++ if(y > 50) return -1 key=key.substring(pos+1,key.length) } } } } return y-1 }
var keywords = new Array() var results
function AddBody() { var keytext='"'+searchname+'?keywords="+' var andtext='"&and="+'
document.write('<script>function doSearch(){'+ 'searchwords=document.searchform.searchwords.value; '+ 'while (searchwords.indexOf(" ")>-1){ pos=searchwords.indexOf(" ");'+ 'searchwords=searchwords.substring(0,pos)+"+"+searchwords.substring(pos+1); }'+ 'document.location='+keytext+' searchwords+'+andtext+'"0"}'+ '<'+'/'+'script>' )
templateBody() document.write("<form name='searchform' method='post' action='javascript:doSearch()'><table border='0' width='100%'><tr><td align='center'><font face='Arial, Helvetica, sans-serif' size='3'><input name='searchwords' type='text' size='30'> <a href='javascript:doSearch()'>"+ButtonCode+"</a></font></td></tr></table></form>") if (usebannercode) bannerCode() }
function DisplayXSearch() { templateEnd() }
function search(keyword) { var hit=0 var addcomplete=0
for (q=0; q<records.length; q++) { addcomplete=0 search_parm=" "+records[q].searchstring()+" " search_parm=search_parm.toLowerCase()
if (keyword.indexOf(' AND ')>0) { firstword=keyword.substring(0,keyword.indexOf(' ')).toLowerCase() lastword=keyword.substring(keyword.indexOf(' AND ')+5,keyword.length).toLowerCase() if ((search_parm.indexOf(" "+firstword+" ") != -1) && (search_parm.indexOf(" "+lastword+" ")!= -1 )) { hit++ finds++ if(hit<2) { if (results[q].val==0) sites++ results[q].val +=2 } } } else { keyword=keyword.toLowerCase() if ((search_parm.indexOf(" "+keyword+" ") != -1) ||(keyword=="[all]")) { hit++ finds++ if(hit<2) { if (results[q].val==0) sites++ results[q].val+=2 } } else { // check for a half hit (ie. search:share find:SHAREware) if (search_parm.indexOf(keyword) != -1) { hit++ finds++ if(hit < 2) { if (results[q].val==0) sites++ results[q].val+=1 x=search_parm.indexOf(keyword)+keyword.length pos=search_parm.substring(1,x-keyword.length) while (pos.indexOf(" ")!=-1) { y=pos.indexOf(" ") pos=pos.substring(y+1,pos.length) } if (pos.length<=2) addcomplete++ pos=search_parm.substring(x,search_parm.length) fullresult=search_parm.substring(x,x+pos.indexOf(" ")) if (fullresult.length<=2) addcomplete++ if (addcomplete>1) results[q].val+=1 } } } } hit=0 } }
var searchwords = '' var newload = true
function initXsearch() { if (searchwords!='') searchAll(searchwords) else if (newload) Cat() }
function tparams(){ parameters=document.location.search parameters=unescape(parameters.substring(1,parameters.length)+'&')
this.params=new Array() i=0 while (parameters.indexOf('&',0)!=-1) { al=this.params.length this.params[al]=new Array() tmp=parameters.substring(0,parameters.indexOf('&',0)) parameters=parameters.substring(parameters.indexOf('&',0)+1)
if (tmp.indexOf('=')!=-1) { this.params[al].command=tmp.substring(0,tmp.indexOf('=')) this.params[al].value=tmp.substring(tmp.indexOf('=')+1) } else { this.params[al].command=tmp this.params[al].value='' } }
return this } tparams.prototype.getValue=function(param){ value='' param=param.toLowerCase() al=this.params.length for (var i=0; i<al; i+=1) if (this.params.command==param) value=this.params.value return value }
params=new tparams() if (params.getValue('keywords')!=''){ searchwords=params.getValue('keywords') origsearchwords=searchwords while (searchwords.indexOf('+')>-1) { pos=searchwords.indexOf('+') searchwords=searchwords.substring(0,pos)+' '+searchwords.substring(pos+1) } } if (params.getValue('sort')!='') if (params.getValue('sort')=='0' || params.getValue('sort')=='false') SortResults=false else SortResults=true if (params.getValue('and')!='') if (params.getValue('and')=='0' || params.getValue('and')=='false') andresult=false else andresult=true if (params.getValue('disp')!='') display_start=parseInt(params.getValue('disp')) Otro archivo llamado db.js con lo siguiente: searchname = 'xsearch-5.2.htm' usebannercode=true ButtonCode = "<img src='searchbutton.gif' border=0>" function templateBody() { document.write('<html><head><title>webtodo.net</title><'+ 'script language="Javascript">'+ '<'+'/'+'script'+'></head><body>'); }
function templateEnd() { document.write('</td></tr></table></font></center></body></html>'); } function bannerCode() { }
/* end configuration settings */
/* database records */
add("<a href='http://www.dynamic-core.net/index.htm'>SiteNews</a>","news whats new updates information site info pascal plan update what's hot","Site news and plan updates") add("<a href='http://www.dynamic-core.net/fusion/index.htm'>Fusion Opensource</a>","fusion overview features screenshots mp3 player manager developers opensource source code sourcecode delphi downloads files","Fusion is a full fledged mp3 manager..<br>..Fusion is opensource and written in Delphi 3, you can download") add("<a href='http://www.dynamic-core.net/jedi/index.htm'>JEDI Javascript editor</a>","jedi javascript editor java script overview information features download jedi.zip files","JEDI is a freeware editing tool for Javascript that lets you create fast javascript powered websites with all the extras found in large programming environments like Delphi or C++ Builder.") add("<a href='http://www.dynamic-core.net/xsearch/tools.htm'>XSearch Tools</a>","xsearch config configuration opensource download xsearchconfig.zip files","This XSearch Config tool was created to make the maintaining of the XSearch database a simple task to do.")
/* end database records */Cada dato nuevo es un add salu2
|
|
|
|
|
En línea
|
PIV 2533 @ 2720Mhz | 512MB DRR333 @ 358 | 160 Gb + 40 Gb Seagate Barracuda
En la Edad Media la Iglesia robaba con los diezmos. En el siglo XXI la SGAE roba con sus cánones.
|
|
|
neokhazer
Desconectado
Mensajes: 25
|
los buscadores internos en html o javascript son muy largos y complicados de usar y modificar. Coge uno en php, que son algo mas sencillos de usar y tal.
|
|
|
|
|
En línea
|
|
|
|
¤ Nerviozzo ¤
Desconectado
Mensajes: 3.960
[*_*]RAP SOLO[*_*]
|
Pero me gustaria insertarlo en una pagina html
|
|
|
|
|
En línea
|
|
|
|
|
Páginas: [1]
|
|
|
|