how to implement search function on a website& its subsi

Mendel

Mr. Upgrade
Veteran
So, at my workplace I'm about to take this huge mission of transforming a series of paper magazines into web news sites

I'm pretty confident I can do this job html editing-wise in about three months if I work hard but there's one feature I'm not proficient with:

I would need to implement a search page where one could write a a word to search for and then be presented with a list of subpages where the word(s) is/are present.

For example, searching for "John Smith" would find all subpages where there is an article or column by him as long as he has written his name on it.

any tutorial type pages on how to do this (with maybe some kind of java or javascript) would be very welcome.
 
What kind of website are you building? Without knowing more it's hard to give good advice. Number of pages? Static or dynamic? Update frequency? Type of content? What type of server? ...

Your choices will basically come down to three categories:

1. External. For example Google.
2. Custom implemented middleware. Exactly what depending on server, and site technology. For example PHPDig.
3. Search function integrated in the CMS. For example EZ Publish.
 
Google is absolutely the easiest. Search for "site:my.site searchstring" Add a form on your page that submits it to Google, drop the results in an iframe and you're done.
 
DiGuru said:
Google is absolutely the easiest. Search for "site:my.site searchstring" Add a form on your page that submits it to Google, drop the results in an iframe and you're done.
That will use Google to search just your site? :oops:

OMG it does and you can do any site, thanks DiGuru! That's another new one for me. :)
 
depends what you really need.... you could make custom search in any server side scripting language that would use forms.... but that depends how you build your database (cause i really doubt you gonna do pure HTML on such big project > thats waste of time, specially in case you need to make changes).

even to most simple include() function in PHP can make your life easier if you gonna do "almost completlly" HTML site.... imagine having 300 HTML pages and adding just one link in navigation....
thats where include() jumps in ;)

maybe you company doesnt want to have power of google search, lets say you just want to be able to see what articles were written by some employee.... you could do this by making drop down HTML menu/form with names and simple SQL query to database....

there are many options out there.... you really need to be more specific on what you want.... ;)
 
Ok, so I have like 500+ pdf files... So I might be able to just export them to rtf and from rtf to html... (if not, well then make htmls by hand and get many many hours of work and money)

and then maybe use that google feature... I'll ask my superiors if such a dirty solution would be acceptable.

Thx

edit:
Add a form on your page that submits it to Google, drop the results in an iframe and you're done.

Ok, I'm still not sure how to do the...
1 submitting to google and
2 dropping the results to iframe.

Any place I should visit or a book I should read to learn that?

edit2: Im familiar with making forms with textareas, labels and buttons, just never figured out how to get the form to actually submit the info to somewhere
 
Save this as search.htm:

Code:
<html>
	<head>
	</head>
	<body>
<!-- Search Google -->
		<FORM method="get" action="http://www.google.com/custom">
			<a href="http://www.google.com/search">
			<img src="http://www.google.com/intl/en/logos/Logo_25wht.gif" border="0" alt="Google"></a>
			<br>  
			<input type="text" name="q" size="20" maxlength="255" value="">
			<input type="submit" name="sa" value="  Search  ">
			<br>  
			<input type="hidden" name="domains" value="beyond3d.com">
			<input type="radio" name="sitesearch" value="beyond3d.com" checked> Beyond3D.com</font>
			<input type="radio" name="sitesearch" value=""> WWW</font>
		</FORM>
<!-- Search Google -->
	</body>
</html>

Make an iframe on a page, like this:

Code:
<iframe  name="iframe1" src="search.htm">

That's it.

Alternatively, you can drop the form (everything between FORM and /FORM) somewhere on the page, as long as it has that iframe on it, or you can specify another target. Just change this line:

Code:
	<FORM method="get" action="http://www.google.com/custom" TARGET="iframe1">

Or any combination.
 
Did some trial&error haxoring with the source code of the google main page... This might do half the trick. At least I'm now submitting stuff to google... but how would I show the results in customised page? I have no idea.

Code:
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><style><!--
body,td,a,p,.h{font-family:arial,sans-serif;}
.h{font-size: 20px;}
.q{color:#0000cc;}
//-->
</style>
<script>
<!--
function sf(){document.f.q.focus();}
// -->
</script>
</head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onLoad=sf() topmargin=3 marginheight=3><center><table cellpadding=0 cellspacing=0 border=0><tr><td align=right valign=bottom></tr><tr><td class=h align=right valign=top><b></b></td></tr></table><br>
<form action=http://www.google.com/search name=f><script><!--
function qs(el) {if (window.RegExp && window.encodeURIComponent) {var qe=encodeURIComponent(document.f.q.value);if (el.href.indexOf("q=")!=-1) {el.href=el.href.replace(new RegExp("q=[^&$]*"),"q="+qe);} else {el.href+="&q="+qe;}}return 1;}
// -->
</script><input type=hidden maxLength=256 size=55 name=q value="site:[url]www.beyond3d.com[/url] "><input maxLength=256 size=55 name=q value=""><br><input type=submit value="Google-haku" name=btnG></form><br></p></center></body></html>

edit: ok, seems like you posted a bit tidier solution :)
 
Mendel said:
Ok, so I have like 500+ pdf files... So I might be able to just export them to rtf and from rtf to html... (if not, well then make htmls by hand and get many many hours of work and money)

and then maybe use that google feature... I'll ask my superiors if such a dirty solution would be acceptable.

Thx

edit:
Add a form on your page that submits it to Google, drop the results in an iframe and you're done.

Ok, I'm still not sure how to do the...
1 submitting to google and
2 dropping the results to iframe.

Any place I should visit or a book I should read to learn that?

edit2: Im familiar with making forms with textareas, labels and buttons, just never figured out how to get the form to actually submit the info to somewhere


well....if i were you i would go for simple solution.
make table in databese with description and keywords for those PDFs and then use one of options posted....

i do see you got it, but this is just suggestion....hope it helps....
 
Back
Top