Search on site

Hi
I like to build up php search script for my site, so members can search for special word, how can i do that.

It’s easiest if the site is dynamic. If you toss the content of your site into a database it’s really simple. If you’re working with includes to include files with the content of your site, it’s not too difficult but it’s a bit more work.

If you’re searching your files then make sure that you’re bringing up results/matches that are part of HTML tags or PHP code.

In other words if you search a file and it has something like:

<ul class="books">
 <li>1984</li>
 <li>The Time Machine</li>
 ...
</ul>

If I search for “books” and the only place in that page that has “books” is the class name, you won’t want to show the page.

(I know this is a bad example because who would have a list of books and not mention the word “books” somewhere in the text! But hey it’s just a simple example and I’m having a really rough day)

yeah, you want to strip html tags. i would do some research (like reading Information Architecture by Lou Rosenfeld). i’m in the process of doing exactly what you’re doing with another site. basically you need to index every page (automate this with a script). then build your search function.