Re: \n and <br>
| From: | Brian V Bonini | Date: | Tue, 11 Nov 2003 15:26:10 +0000 |
| Subject: | Re: \n and <br> | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169176@lists.php.net to get a copy of this message | ||
On Mon, 2003-11-10 at 20:21, Eugene Lee wrote:
> On Mon, Nov 10, 2003 at 04:05:07PM -0800, Chris Shiflett wrote:
> :
> : --- Eugene Lee <list-php-1@fsck.net> wrote:
> : >
> : > Warning: nl2br() is not safe because it emits "<br />" tags which do
> : > not always work on all browsers (especially browsers not explicitly
> : > advertised to be XHTML-compliant).
> :
> : Can you name a single browser that cannot properly render a <br /> tag?
>
> There were rendering problems discovered with one popular web forum
> software called vBulletin.
So just change it....
$string = nl2br($content->page_content);
$string = eregi_replace("<br />", "<br>", $string);
In light of this perhaps something like:
nl2br(string, int)
would be a nice addition where int is 1 or 2 for xhtml or html tags.
Although it's odd that this would break anything as it's purpose is
backward compatibility.