Re: Help with formating text from PHP

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

 



Budelak wrote:

You guys thanks for the encouragement.
I finally solved it with this:

<?php $text= preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $rsDailynewsDetail->Fields('newsfull')); echo $text; ?>

Help came of course from the link Holmes gave.

You're welcome, I think. Why didn't you just use nl2br()?


If you must use a method like you're using now, then this should work better and faster:

$text = str_replace(array(chr(13).chr(10),chr(13),chr(10)),'&nbsp;<br />',$rsDailynewsDetail->Fields('newsfull'));

Note that the output of this and what you're using now is going to be spread out on one huge line in your HTML source because your removing the newlines. Since HTML ignores them, I don't see why they need to be removed.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
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