Re: Implementing search in a database driven website
| From: | Robby Russell | Date: | Wed, 27 Oct 2004 00:01:43 +0000 |
| Subject: | Re: Implementing search in a database driven website | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37037@lists.php.net to get a copy of this message | ||
On Tue, 2004-10-26 at 16:57 -0700, Robby Russell wrote:
> On Wed, 2004-10-27 at 00:33 +0530, Vinayakam Murugan wrote:
> > Hi
> >
> > I have a PHP-mysql website in which I want to implement search functionality.
> >
> > Through the content management section, the user can enter data into
> > the database. Here he can enter HTML tags and embedded CSS stylesheets
> > also. Now the problem is while searching the table, I want to show
> > couple of lines of the relevant text. This gets displayed along with
> > the HTML tags and CSS entries. Is there anyway I can display only the
> > text ? I have tried strip_tags but it does not strip the CSS entries.
> >
> > --
> > Warm Regards
> > ~~~~~~~~~~~~
> > Vinayak
> >
>
> You're going to have replace all the css tags when you pull the data
> out...or rethink how you handle this sort of stuff in your CMS.
> (html/css inside the content isn't fun to deal with)
>
> -Robby
>
found on php.net,http://us2.php.net/strip_tags (bottom)
$string=
preg_replace("'<style[^>]*>.*</style>'siU",'',$string);
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby@planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc