RE: Convert plain text to HTML tagged text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



why not do a search and replace on the way out to the browser?

<?
...
$text = $rows['longtextobject'];

$text = str_replace("\r,"<p>",$text);

...
echo $text;

...
?>

bastien
From: veditio@xxxxxxxxxxx
To: php-db@xxxxxxxxxxxxx
Subject:  Convert plain text to HTML tagged text
Date: Tue, 28 Sep 2004 17:15:24 +0000

To the list:

I've googled and searched the manual, but I'm still looking for a simple solution to a simple problem.

I have a MySQL database of text stories in longtext MySQL fields. These stories have simple returns (\r) in them and no other formatting. I need to use these stories both for web and print production, so I need to be able to get the text out of MySQL via PHP and have those returns change to <P> tags. But I also need to keep those extra <P> tags out of the database file so the text can be exported and poured into a layout program.

HTMLspecialchars and HTMLentities don't seem like the right solution, but maybe I'm missing something. Do I have to use regular expressions in PHP as the text is pulled from the database?

Thanks in advance for your help.

--veditio

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet has to offer. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux