views:

58

answers:

2

i wonder how you get the search results that is highlighted like Google?

They search a text for the keyword you entered and then chop the text some nr of letters before and after the keyword and highlight it?

How do you accomplish that with PHP. What functions should you use to search the keyword and then return a specific length before and after the keyword?

A: 

They search a text for the keyword you entered and then chop the text some nr of letters before and after the keyword and highlight it?

Yes

How do you accomplish that with PHP. What functions should you use to search the keyword and then return a specific length before and after the keyword?

It's not done only with PHP, you'll need ajax too. There are several jquery plugins available (search for jquery dropdown search)!

Andreas Bonini
I'm not sure you two are referring to the same thing. Google doesn't need to use ajax for it's search results page. Andreas, perhaps you are thinking of the Google Suggest feature?
invariant
I am; I thought he was asking about the dropdown suggestions (if you type goo a dropdown appears with "google", etc). I must have misunderstood!
Andreas Bonini
+2  A: 

strpos and strstr should do it.

Grumdrig
is there any availabe scrips for that?
weng