RE: [PHP] Re: nl2br problem
| From: | Vail, Warren | Date: | Fri, 28 May 2004 18:19:16 +0000 |
| Subject: | RE: [PHP] Re: nl2br problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187156@lists.php.net to get a copy of this message | ||
Sounds like you have tab characters and blanks controlling your indentation
and html will display only one blank between text characters, has nothing to
do with nl2br. This does not happen when you use <pre></pre> tags, but then
the <br> doesn't work either.
Warren Vail
-----Original Message-----
From: Gerben [mailto:gerbendekeijzer@12move.nl]
Sent: Friday, May 28, 2004 11:12 AM
To: php-general@lists.php.net
Subject: [PHP] Re: nl2br problem
my indentation is screwed up when I use nl2br();
"Justin Patrin" <papercrane@reversefold.com> wrote in message
news:20040528174201.66493.qmail@pb1.pair.com...
> Gerben wrote:
>
> > If have some problems with the nl2br function. It f*cks up my
> > layout. does anyone know how to create a true nl2br function in
> > stead of a nl2br-and-nl function. i.e. I just want everything on one
> > line.
> >
> > I used:
> > str_replace("\n", "", nl2br($text));
> > but I don't like it that much and I don't know if nl2br produces
> > "\r"-s
> >
> > Greetings,
> > Gerben
> > Holland
>
> I'm not quite sure how extra newlines could be screwing up your
layout.....
>
> If you just want to remove all newlines from your text before
> outputting, you could use:
>
> $text = str_replace(array("\r", "\n"), '', $text);
>
> You could also do something like this:
>
> $text = str_replace(array("\r\n", "\r", "\n"),
> '<br/>', $text);
> --
> paperCrane <Justin Patrin>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php