|
Posted by Markus Ernst on 06/12/06 11:13
Geoff Berrow schrieb:
> Message-ID: <1149878029.315129.193540@u72g2000cwu.googlegroups.com> from
> John Dunlop contained the following:
>
>
>>>I never heard about a case where <br /> did cause any problem...
>>
>> I can think of a couple. For example, validation. <br /> means
>>something different in HTML than it does in XHTML. In HTML, '/' closes
>>the tag and '>' is treated literally. Not a big problem, maybe, but
>>probably not what you meant.
>
>
> It is annoying though that nl2br() only returns <br /> Would it be so
> difficult to include a switch so that it could output <br> ?
>
I agree with both your points - in some cases I just prefer to go the
easy way as long as it can be expected to be supported by browsers for
the next few decades...
Actually it might be a good idea to introduce an ini setting or a
constant with the HTML version to generate for all kinds of HTML
generating functions.
Of course this will generate problems where text is post-processed, for
example double line breaks are changed to new paragraphs:
$text = nl2br($text);
$text = '<p>'.str_replace('<br /><br />', '</p><p>', $text).'</p>';
The str_replace needle will have be changed to nl2br("\n\n").
--
Markus
[Back to original message]
|