Re: [PHP] \n \t don't work!!!
At 13:22 13-10-03, you wrote: Guys, These codes are copied from the manual: * echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ** None of them works. They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. I suppose your manual was not intending on making html pages, or it was a very lousy one. I would recommend reading the first chapters of the manual on www.php.net to get a general idea of PHP. Then read some tutorials on for instance phpfreaks.com. I mean there're not any new lines generated in my browser and I have to use the echobr to print a new line. But why doesn't the \n work? BTW, the \t doesn't work either. (WindowsXP Pro + PHP Version 4.1.1) Please advise. cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
It DOES work, look at the source html code. Wang Feng wrote: Guys, These codes are copied from the manual: * echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ** None of them works. I mean there're not any new lines generated in my browser and I have to use the echobr to print a new line. But why doesn't the \n work? BTW, the \t doesn't work either. (WindowsXP Pro + PHP Version 4.1.1) Please advise. cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. The page source shows: htmlbody/body/html I suppose your manual was not intending on making html pages, or it was a very lousy one. I do want to just make a html page. The following is my source code, and what I expect is to see the new lines when the \n appears, ok? * html headtitleHello World Program/title/html body ?php echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ? /body /html ** So, what's the problem here? cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
Ok, Now I see what happen (maybe). So, the \n is not for the browser output, but for the *view source*? So, it's different from the echo br? If so, what's the deal to do that? --- Makes it look nice if the user view the source code? cheers, feng - Original Message - From: Chris Hayes [EMAIL PROTECTED] To: Wang Feng [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, October 13, 2003 9:29 PM Subject: Re: [PHP] \n \t don't work!!! At 13:22 13-10-03, you wrote: Guys, These codes are copied from the manual: * echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ** None of them works. They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. I suppose your manual was not intending on making html pages, or it was a very lousy one. I would recommend reading the first chapters of the manual on www.php.net to get a general idea of PHP. Then read some tutorials on for instance phpfreaks.com. I mean there're not any new lines generated in my browser and I have to use the echobr to print a new line. But why doesn't the \n work? BTW, the \t doesn't work either. (WindowsXP Pro + PHP Version 4.1.1) Please advise. cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
Wang Feng wrote: The page source shows: htmlbody/body/html The problem might be right here --+ (closing html tag)| html | headtitleHello World Program/title/html body ?php echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ? /body /html ** Simple: html headtitleHello World Program/title body ?php echo (this is the simplest, an SGML processing instructionbr); echo This spansbrmultiple lines. The newlines will bebroutput as well; echo This spansbrmultiple lines. The newlines will bebroutput as well.; ? /body /html In html you cannot use newlines for formating, use br if you need newline. You can use pre tag for preformated text however. So, what's the problem here? cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
On Mon, Oct 13, 2003 at 09:48:56PM +1000, Wang Feng wrote: : : Ok, Now I see what happen (maybe). : : So, the \n is not for the browser output, but for the *view source*? So, : it's different from the echo br? : : If so, what's the deal to do that? --- Makes it look nice if the user view : the source code? When normally rendering HTML text, multiple continuous whitespace characters (i.e. \s+) as a single space. So HTML source code: pHow are you? I am fine. What else is new? /p gets displayed as this: How ar you. I am fine. What else is new? To force a visual linebreak in rendered HTML pages, as you already discovered you need to manually insert br tags. However, if you don't want to litter your HTML source code with a bunch of gratuitous br tags all over the place, use the pre container tag to make the browser render newlines as visual linebreaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
If you want it to work with \n, then you will need to use the pre/pre tags. Otherwise you need to translate the \n's into br tags. \n is NOT an html tag so when you print them to the browser, it adds lines to the source, but as you might already know, a new line in the source of an html page does NOT give a new line in the output unless you use an html tag that would give the new line. Steve At 06:39 AM 10/13/2003, you wrote: They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. The page source shows: I suppose your manual was not intending on making html pages, or it was a very lousy one. I do want to just make a html page. The following is my source code, and what I expect is to see the new lines when the \n appears, ok? * body ?php echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ? /body /html ** So, what's the problem here? cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
Do what I do, use both the \n and the br tags. I am not worried about anybody else thinking the source is nice looking, I do it for debugging so that I can see how the source comes out in a readable format. Steve At 06:48 AM 10/13/2003, you wrote: Ok, Now I see what happen (maybe). So, the \n is not for the browser output, but for the *view source*? So, it's different from the echo br? If so, what's the deal to do that? --- Makes it look nice if the user view the source code? cheers, feng - Original Message - From: Chris Hayes [EMAIL PROTECTED] To: Wang Feng [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, October 13, 2003 9:29 PM Subject: Re: [PHP] \n \t don't work!!! At 13:22 13-10-03, you wrote: Guys, These codes are copied from the manual: * echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ** None of them works. They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. I suppose your manual was not intending on making html pages, or it was a very lousy one. I would recommend reading the first chapters of the manual on www.php.net to get a general idea of PHP. Then read some tutorials on for instance phpfreaks.com. I mean there're not any new lines generated in my browser and I have to use the echobr to print a new line. But why doesn't the \n work? BTW, the \t doesn't work either. (WindowsXP Pro + PHP Version 4.1.1) Please advise. cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
Thank you all for pointing me to the *right* direction!!! Now I really understand why and what I can do with the \n in php. :-) cheers, feng - Original Message - From: Eugene Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 13, 2003 10:58 PM Subject: Re: [PHP] \n \t don't work!!! On Mon, Oct 13, 2003 at 09:48:56PM +1000, Wang Feng wrote: : : Ok, Now I see what happen (maybe). : : So, the \n is not for the browser output, but for the *view source*? So, : it's different from the echo br? : : If so, what's the deal to do that? --- Makes it look nice if the user view : the source code? When normally rendering HTML text, multiple continuous whitespace characters (i.e. \s+) as a single space. So HTML source code: pHow are you? I am fine. What else is new? /p gets displayed as this: How ar you. I am fine. What else is new? To force a visual linebreak in rendered HTML pages, as you already discovered you need to manually insert br tags. However, if you don't want to litter your HTML source code with a bunch of gratuitous br tags all over the place, use the pre container tag to make the browser render newlines as visual linebreaks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
To give tabs in html, you might want to try using nbsp; nbsp; nbsp; instead of \t Steve At 06:57 AM 10/13/2003, you wrote: Wang Feng wrote: The page source shows: htmlbody/body/html The problem might be right here --+ (closing html tag)| html | headtitleHello World Program/title/html body ?php echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ? /body /html ** Simple: ?php echo (this is the simplest, an SGML processing instruction ); echo This spans multiple lines. The newlines will be output as well; echo This spans multiple lines. The newlines will be output as well.; ? In html you cannot use newlines for formating, use br if you need newline. You can use pre tag for preformated text however. So, what's the problem here? cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] \n \t don't work!!!
[snip] To give tabs in html, you might want to try using nbsp; nbsp; nbsp; instead of \t [/snip] And one other thing I didn't see mentioned http://www.php.net/nl2br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
On Mon, Oct 13, 2003 at 08:10:39AM -0500, Jay Blanchard wrote: : : [snip] : To give tabs in html, you might want to try using nbsp; nbsp; nbsp; : instead of \t : [/snip] : : And one other thing I didn't see mentioned http://www.php.net/nl2br Note that nl2br() is XHTML compliant, which means it sends out br / tags instead of br tags. This is a problem on browsers that do poorly with mixed HTML and XHTML tag styles in the same body content. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
--- Eugene Lee [EMAIL PROTECTED] wrote: Note that nl2br() is XHTML compliant, which means it sends out br / tags instead of br tags. This is a problem on browsers that do poorly with mixed HTML and XHTML tag styles in the same body content. Which browsers does this refer to? 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