You are here: Re: string highlight « PHP « IT news, forums, messages
Re: string highlight

Posted by David Duong on 06/08/05 02:30

David Duong wrote:
> Sebastian wrote:
>
>> i'm looking for a function that can highlight certain search terms in
>> a string. anyone have something already made that i can plugin to my
>> exisiting code?
>>
>> I found a couple but they do not work very well.. some break html code
>> if the string contains the keywords in the html.
>>
>> thanks.
>
> You can use str_replace to "highlight" the search terms.
>
> For example, you could use the following code for each search term (this
> function also accepts arrays, see http://php.net/str_replace):
>
> str_replace ($search_term, "<b>$search_term</b>", $body_text);
>
> - David
I forgot to mention that if you wanted to have a highlighting effect,
you will need to use stylesheets.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация