Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with search within Dream Weaver Pages

Status
Not open for further replies.

joepc

MIS
Joined
Jul 26, 2002
Messages
647
Location
US
What's up guys?

I need to create a search engine with in a web site. I just want to be able to search my site for specific items.

The web site I am working on is going to be a tech site for myself and my coworkers. Basically when we run into a problem that we don't know the anwser to we create a log in a text file that says what we did to fix it. We then add it to the web site so when next time we encounter the problem we will have the answer on our site. If anyone could give me any feed back on how I would do this it would be GREATLY appreciated.

Thanks for ANY help or suggestions.
 
TWO STEPS TO INSTALL SITE SEARCH:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document

STEP ONE: Paste this code into the HEAD of your HTML document

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

<!-- Begin
var item = new Array();

/* Here is where all the magic happens.
Just enter as many additional pages that
that you want to search, then fill in the
additional listings for each page.
*/

// &quot;Page Name&quot;,&quot;path&quot;,&quot;Page Title&quot;,&quot;Many,Key,Words&quot;,&quot;Descriptive Comments&quot;

c=0; item[c]=new Array(&quot;index.html&quot;,&quot;&quot;,&quot;DemoSite&quot;,&quot;index,main,start,home,front&quot;,&quot;Demonstration search engine data about an imagined but probable internet site.&quot;);
c++; item[c]=new Array(&quot;about.htm&quot;,&quot;&quot;,&quot;About Me&quot;,&quot;about,author,contact,email,who&quot;,&quot;Contact details and general information about the creator of the site and what the site is about.&quot;);
c++; item[c]=new Array(&quot;links.htm&quot;,&quot;&quot;,&quot;Links page&quot;,&quot;links,more,where,similar,friends&quot;,&quot;Links to my favourite sites which I find interesting. Other friends sites which have similar interests to my own.&quot;);
c++; item[c]=new Array(&quot;main.htm&quot;,&quot;main/&quot;,&quot;Main Page&quot;,&quot;content,main,focus&quot;,&quot;The main part of my site which contains what you have come to see. Lots of stuff like that and more great things. All in a sub directory.&quot;);
c++; item[c]=new Array(&quot;logo.jpg&quot;,&quot;main/images/&quot;,&quot;Link Logo&quot;,&quot;link,image,logo,graphic&quot;,&quot;The logo.jpg is just a small image which you can place on your site as a link to me. It's in a second level subdirectory.&quot;);

page=&quot;<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>&quot;;


function search(frm) {
win = window.open(&quot;&quot;,&quot;&quot;,&quot;scrollbars&quot;);
win.document.write(page);
txt = frm.srchval.value.split(&quot; &quot;);
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != &quot;&quot;)
fnd += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write(&quot;</table><br>Total found: &quot;+total+&quot;<br></body></html>&quot;);
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = &quot;<tr><td><a href='&quot;+link+&quot;'>&quot;+item[which][2]+&quot;</a> Score: &quot;+num+&quot;<br>&quot;;
line += item[which][4] + &quot;<br>&quot;+link+&quot;</td></tr>&quot;;
wind.document.write(line);
return 1;
}
// End -->
</script>
</HEAD>

STEP TWO: Copy this code into the BODY of your HTML document


<form method=get action=&quot;javascript:void(0)&quot; onsubmit=&quot;search(this); return false;&quot;>
<tr><td><input type=text name=srchval value=&quot;&quot;><input type=submit value=&quot;Search&quot;></td></tr>

</center>
Ranjan
fragments of dream, weave them together
 
just one little word: use [ignore]
Code:
script goes here...
[/ignore] ;-) Good Luck! :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top