Re: [PHP] \n and br
Chris Shiflett wrote: --- Eugene Lee [EMAIL PROTECTED] 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? I know NN 4.x has problems with br/ /found this out the hard way/ but I don't know of any browser that can't render br /. Although I would love to be proved wrong here :P -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com --- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
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 [EMAIL PROTECTED] 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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
Brian V Bonini wrote: So just change it $string = nl2br($content-page_content); $string = eregi_replace(br /, br, $string); Why not directly str_replace(array(\r\n,\r,\n), 'br', $content-page_content); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
On Tue, 2003-11-11 at 14:51, Marek Kilimajer wrote: Brian V Bonini wrote: So just change it $string = nl2br($content-page_content); $string = eregi_replace(br /, br, $string); Why not directly str_replace(array(\r\n,\r,\n), 'br', $content-page_content); You say tomato I say ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] \n and br
[snip] is \n same as br I found that \n does the same function as br for some users, but not for me. I know that \n creates a break in source and not in display. Is it possible to make \n does the same function as br [/snip] http://us3.php.net/nl2br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] \n and br
\n is the code to write a new line, between double quotes. Actually it translates to a 0D or 0A code. If there is a 0D or 0A in a text or file (or normal text email) it works as a newline. If you look at the _source_ of your HTML file you will see it too. BR is the HTML code for new line. Browsers understand only BR (well and P and H1-6 also cause a new line), they are taught to ignore the 0A and 0D. If you have a piece of text coming in from a textarea or database, it usually will have the \n type code. To show such texts in a HTML page you have to translate the \n to BR. Because this is so common, PHP has the function nl2br(). If you pronounce this say: NewLine To BReak. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
--- PHPLover [EMAIL PROTECTED] wrote: is \n same as br This is not true. I know that \n creates a break in source and not in display. Is it possible to make \n does the same function as br No, but you can convert your newlines to the HTML equivalent: http://www.php.net/nl2br Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
On Mon, Nov 10, 2003 at 06:57:54AM -0800, Chris Shiflett wrote: : : --- PHPLover [EMAIL PROTECTED] wrote: : : is \n same as br : : This is not true. : : I know that \n creates a break in source and not in display. : Is it possible to make \n does the same function as br : : No, but you can convert your newlines to the HTML equivalent: : : http://www.php.net/nl2br 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). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] \n and br
Eugene Lee mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 3:58 PM said: 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). My original response (in my mind) was Which happens to be none. But then I got curious. Pray tell Eugene, which browsers (text or graphical) do not support the br / and other XHTML type tags? Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
--- Eugene Lee [EMAIL PROTECTED] 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? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
Chris Shiflett wrote: --- Eugene Lee [EMAIL PROTECTED] 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? Chris The old Prodigy 'browser' from the early 90's? ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
Eugene Lee wrote: On Mon, Nov 10, 2003 at 06:57:54AM -0800, Chris Shiflett wrote: : : --- PHPLover [EMAIL PROTECTED] wrote: : : is \n same as br : : This is not true. : : I know that \n creates a break in source and not in display. : Is it possible to make \n does the same function as br : : No, but you can convert your newlines to the HTML equivalent: : : http://www.php.net/nl2br 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). If that is the case and you would not like the xhtml compliancy, then just do a str_replace('br /','br',$data); after you do the nl2br, everything cured :) Rolf Brusletto http://www.phpExamples.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
--- John Nichel [EMAIL PROTECTED] wrote: The old Prodigy 'browser' from the early 90's? ;) Is that a guess or an answer? I don't see it here: http://browsers.evolt.org/ That's the only place I know to find old browsers with which to test things like this. If you have any other information, I'd be glad to do the research. Still, I doubt any browser that is used by more than 0.1% of Web users mishandles an XHTML-compliant br tag. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
Chris Shiflett wrote: --- John Nichel [EMAIL PROTECTED] wrote: The old Prodigy 'browser' from the early 90's? ;) Is that a guess or an answer? It was a joke. Maybe I'm just too old. *G* -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] \n and br
John Nichel mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 5:18 PM said: It was a joke. Maybe I'm just too old. *G* Or maybe you're just not funny. OOOH MOTED! :) Why does it feel like Friday??? p.s. i got your joke and no offense, just teasing. please feel free to make fun of me too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
On Mon, Nov 10, 2003 at 04:05:07PM -0800, Chris Shiflett wrote: : : --- Eugene Lee [EMAIL PROTECTED] 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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
Chris W. Parker wrote: John Nichel mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 5:18 PM said: It was a joke. Maybe I'm just too old. *G* Or maybe you're just not funny. OOOH MOTED! :) Why does it feel like Friday??? p.s. i got your joke and no offense, just teasing. please feel free to make fun of me too. This could be why HBO hasn't been knocking on my door and offering me a few million to do my stand-up routine. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
--- Eugene Lee [EMAIL PROTECTED] wrote: 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. That's not a browser. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
On Mon, 2003-11-10 at 20:30, John Nichel wrote: This could be why HBO hasn't been knocking on my door and offering me a few million to do my stand-up routine. This appears to be off-topic, and so to drive the point home in your own self-righteous drivel: John Nichel spewed one day: If something as trivial as this is where you want to make your big stand in life, please do it offlist Have a nice day. Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
--- Robert Cummings [EMAIL PROTECTED] wrote: This appears to be off-topic, and so to drive the point home in your own self-righteous drivel: Robert, that is enough of this. Please take your pesonal differences elsewhere. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n and br
On Mon, 2003-11-10 at 21:44, Chris Shiflett wrote: --- Robert Cummings [EMAIL PROTECTED] wrote: This appears to be off-topic, and so to drive the point home in your own self-righteous drivel: Robert, that is enough of this. Please take your pesonal differences elsewhere. I was merely trying to keep the list on-topic. I felt so berated by John Nichel yesterday that I felt myself suddenly inclined to only post on-topic and to help enforce the standard across all of the PHP general list. I can retract this behaviour if you wish, but it strikes me as a tad biased that what is good for one, is not good for another. Smells like a veritable double standard. Perhaps I've learned the wrong lesson. This will be the last you'll hear from me on this thread. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n to BR Problem
try this function nltobr() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n to BR Problem
on 07/09/02 1:51 AM, N. Pari Purna Chand ([EMAIL PROTECTED]) wrote: $newstr = ereg_replace (\n, BR, $newstr); Instead, I think you'd have to escape the slash: \\n... but it's irrelevant, because there's a function that does this for you: $newstr = nl2br($newstr); Also, you should try to use str_replace('was', 'is', $str), because it's less resource intensive than ereg* Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n to BR Problem
Chandu, et al -- ...and then N. Pari Purna Chand said... % % I have a small problem in converting a plain text to html. Son of a gun... Maybe it's world consciousness working on this :-) I've just posted a similar question. Be sure to watch both threads just in case. HTH HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg78073/pgp0.pgp Description: PGP signature
Re: [PHP] \n to BR Problem
At 23:51 09/06/2002, you wrote: I have a small problem in converting a plain text to html. snip $newstr = ereg_replace (\n, BR, $newstr); try $newstr = ereg_replace(\n\r|\n|\r, BR, $newstr); notice it looks for all types of line feeds -jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n to BR Problem
At 23:51 09/06/2002, you wrote: I have a small problem in converting a plain text to html. snip $newstr = ereg_replace (\n, BR, $newstr); try $newstr = ereg_replace(\n\r|\n|\r, BR, $newstr); notice it looks for all types of line feeds -jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php