[PHP] Re: New line characters and carriage returns

2003-10-25 Thread James Moe
Jonathan Villa wrote:
$msg .= From: [EMAIL PROTECTED]
Content-Type: text/plain\r\n
  PHP is retaining the implicit linefeed in the text so there is a 
blank line between From and Content-Type, the end-of-header indicator. 
(You must have a dos-ish system.)
  Change it to:
$msg .= From: [EMAIL PROTECTED] . Content-Type: text/plain\r\n;

$fileName = 'errors.'.date('dmY').'.log';

  The log files will sort a lot more sensibly if you use 'Ymd'.

--
jimoe at sohnen-moe dot com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: New-line characters

2002-04-05 Thread Jamie Watt

You'de be better off using the built in nl2br() function
(http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect
as a it'll insert a br tag everwhere a newline character occurs.  Where 2
newline characters occur it will produce brbr which in your HTML will
break your text in the same way that a p tag would.


James Stewart [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED].
..
 Hi,

 I have a form for users of a system I am developing to add their
newsletters
 to a MySQL database through. I take their input and INSERT it straight
into
 the database after adding slashes.

 When I retrieve the information from the database I would like to replace
 double occurences of new-lines with a p tag. Can anyone tell me what
 regexp I should be searching for?

 cheers. James.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: New-line characters

2002-04-05 Thread Maxim Maletsky


FYI: 

brbr is not same as p. P is paragraph and br is just a line break of 
the text. So, depending on your text format the lines broken twice might 
(normally ARE but not too noticeably) look different. 

try to mess with CSS and you'll see the difference about how browsers see 
those both ways. 

In the poster's case, to have a p out of brbr he should still use 
nl2br() and then add this to it: 


$text = preg_replace(/\w*br\w*br\w*/i, \n\np, $text); 


Cheers, 

Maxim Maletsky 

Founder, Chief Developer
PHPBeginner.com (Where PHP Begins) 

www.PHPBeginner.com
[EMAIL PROTECTED] 

Jamie Watt writes: 

 You'de be better off using the built in nl2br() function
 (http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect
 as a it'll insert a br tag everwhere a newline character occurs.  Where 2
 newline characters occur it will produce brbr which in your HTML will
 break your text in the same way that a p tag would. 
 
 
 James Stewart [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED].
 ..
 Hi, 

 I have a form for users of a system I am developing to add their
 newsletters
 to a MySQL database through. I take their input and INSERT it straight
 into
 the database after adding slashes. 

 When I retrieve the information from the database I would like to replace
 double occurences of new-lines with a p tag. Can anyone tell me what
 regexp I should be searching for? 

 cheers. James. 

  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php 
 
 


Maxim Maletsky 

Founder, Chief Developer
PHPBeginner.com (Where PHP Begins) 

www.PHPBeginner.com
[EMAIL PROTECTED] 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php