Web Design Forums

Welcome! Please register or log in: Forgot your password? Why register?
You are here: Web Design Forums » Web Design Help » HTML and CSS Help » searching html content RSS

searching html content

This thread was started by ketanco and has been viewed 330 times, and contains 10 replies, with the last reply made by mlseim.
Post Reply
1
View ketanco's reputation
ketanco, Must... Post... More...! Private message   E-mail
Posted June 13 '09 at 10:16 AM
      Posts: 228
Is anybody able to tell me how can I make a search box for searching the html content of my website? Also I have many htm files, I want them searched too...

Or, should I just paste one from yahoo or google and that woudl solve the problem? (I mean are they for searching the html of MY site or the whole web?)

Lastly, I already have a search box for searching the data in my mysql databases. Is there a way to have a combined searchbox that is able to seach both the htm, html and mysql portions of my website?

Advertisement Register for free to hide these ads and participate in discussions!

2
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted June 13 '09 at 04:41 PM
      Posts: 3,100
Usually, the HTML page is generated from a database.
So searching the HTML is not necessary. But you must have
some static web pages?
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

3
58 points at 100%
imagn, WDF Addict! Home page   Private message  
Posted June 14 '09 at 03:17 PM
      Posts: 156
You can PHP's CURL to "read" your static pages and then run regular expression to search for whatever your visitors entered.

Have you looked into adding Google search? The free version displays the small ads and there is a cheap paid version ($100/year) that omits them.

4
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 14 '09 at 03:18 PM
      Posts: 784
hey i was just thinking about the google search tool imagn. thx for the info
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

5
View ketanco's reputation
ketanco, Must... Post... More...! Private message   E-mail
Posted June 14 '09 at 05:17 PM
      Posts: 228
well, yes I might have some static pages, because for one page, the content will vary greatly in format from one week to another, so if I use php i will be stuck with just one format, though it will be automatic. so thats why i wanted to see how can i search static pages as well.

6
34 points at 74%
Dorky, Freelance Home page   Private message  
Posted June 14 '09 at 05:23 PM
      Posts: 784
nono you can use conditional php (if) statements for entire divs or an entire layout for that matter.
“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” Albert Einstein

7
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted June 15 '09 at 03:30 PM
      Posts: 3,100
Let's say you search for a word somewhere within your HTML pages.
Example, the word "photograph" ...
What happens when it finds that word in your HTML?

Does it display the whole page?
Does it display the line where it was found?

That's the problem with searching your HTML ...
What will you do with your result(s) ... and what if you have 50 results from 3 pages?
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

8
58 points at 100%
imagn, WDF Addict! Home page   Private message  
Posted June 15 '09 at 08:33 PM
      Posts: 156
You would use the array functions to combine same-page hits and just display a list of those returned. You could even add a psuedo-relevancy score by the number of hits on a given page. Once you're on the page you can also use a reg exp to highlight the word(s) a user looked for.

It can be a bit of a pain which is why I still say Google

9
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted June 18 '09 at 09:40 AM
      Posts: 3,100
Trace ...
Not sure what that means.

You mean searching for HTML tags, like <div> and <body> and <img src>?
Or text between tags? HTML really has nothing worth searching.
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

10
View drwatz0n's reputation
Posted June 19 '09 at 10:33 PM
      Posts: 2
nono you can use conditional php (if) statements for entire divs or an entire layout for that matter.

Well, he could do that, but it would require some modification to his site. As of now, all he would like to do is integrate some sort of search system.

Would it be possible to create your own list of search "terms", and once the search is performed, return a list of articles/content relating to the term? If your page contains a lot of static HTML pages, then I would assume you have some sort of understanding/naming scheme for the pages (say "may_photos", or "fall_photos"). For example, searching "photos" would return a list of all of your static pages that fit with "photos".

The upside to this is that you don't need to search every single page of your site, or convert it to some sort of heavily-PHP based system, which isn't something you have now (from what I was able to garner). The downside is that you must define each of the results returned for each query. Once it's set up, it should be fairly easy to maintain, but, depending on the size of your site, may take some time to set up fully.

11
1,251 points at 99% Moderator Repute
mlseim, WDF Moderator Private message  
Posted June 20 '09 at 11:16 AM
      Posts: 3,100
Dr.

Would it be possible to create your own list of search "terms", and once the search is performed, return a list of articles/content relating to the term?

That's the whole point of having the "content" in a database to begin with.
Going back to post #2 ... there would be no reason to search each HTML page.

If someone is manually adding content "articles" to each static page manually,
then they are pretty much beyond the use of PHP to search their site.
Do you see what I mean?
If it's zero degrees outside today, and it's supposed to be twice as cold tomorrow, how cold is it going to be?

Post Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database vs html content for SEO ketanco Search Engine Optimization / SEO 0 February 15 '09 02:36 AM
firefox problem diddy HTML and CSS Help 3 August 18 '08 09:45 PM
How do I wrap a div in another? Jason HTML and CSS Help 4 May 18 '07 06:26 PM
Layout Basics JR Coding Articles & Tutorials 13 April 29 '05 12:02 PM