You are here: Re: Newline (\n) in printf doesn't work? « PHP Programming Language « IT news, forums, messages
Re: Newline (\n) in printf doesn't work?

Posted by Jerry Stuckle on 06/01/07 11:06

Tim Roberts wrote:
> Jerry Stuckle <jstucklex@attglobal.net> wrote:
>
>> Tim Roberts wrote:
>>> Michael <MichaelDMcDonnell@yahoo.com> wrote:
>>>> I'm new to PHP.
>>>>
>>>> I see that PHP supports the C printf function, and I've seen examples
>>>> like printf("Hello world!\n"); however the newline character \n
>>>> doesn't work - i.e., it does not generate an HTML <br>, which I would
>>>> have expected - what it does is generate a newline in the html
>>>> generated text, but since the browser ignores blank lines, this
>>>> feature appears useless for most applications.
>>> What about <pre> or <textarea> regions? What if I care about the way my
>>> generated HTML looks, and I want things to line up neatly?
>> The first rule of HTML is - make your layout fluid! Allow it to adjust
>> to the size of the user's browser window.
>
> What I meant is, "what if I want my HTML code to line up neatly?" For
> example:
> <select name="City">
> <option>Albany</option>
> <option>Portland</option>
> <option>Salem</option>
> <option>Tigard</option>
> </select>
>
> The browser would be perfectly happy with one immensely long line, of
> course, but it's not unreasonable for me to want the HTML to look like the
> above, and that requires printing \n newlines.

What does this have to do with converting newline characters to <br>?
Newline characters will affect the generated html, <br> won't.

But if you really want to bloat your html with lots of extra white
space, increasing the amount of bandwidth required to load your pages
and slow down your customers, by all means, do it.

Now I'm not suggesting you have no formatting - but you can overdo it, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация