Re: [PHP] Extra spacing with br in HTML

2002-07-28 Thread Justin French

I *think* you've got a typo -- you've said ln2br instead of nl2br i think.

Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
something to the resulting code, like replacing /libr / with /li:

?
$original = ulliBlar/li/ul;
$new = nl2br($original);
$new = str_replace('/libr /', '/li', $new);
?

Either that, or write your own version of nl2br which ignores /li (*no
way* I'd both doing this)


Justin French


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




Re: [PHP] Extra spacing with br in HTML

2002-07-28 Thread Justin French

on 28/07/02 12:53 PM, Jason Stechschulte ([EMAIL PROTECTED]) wrote:

 There might be an easier way, but you might just have to write your own
 code for this.  Something along the lines of: (completely untested)
 
 ?php
 $line = ereg_replace((^li|^ul|^ol)\n, br /\n, $line);
 ?

Definately an easier way (IMHO) -- just let nl2br() do what it does, then
replace the problematic /libr / with just a br /:

?
$original = ulliBlar/li/ul;
$new = nl2br($original);
$new = str_replace('/libr /', '/li', $new);
?


Justin


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




Re: [PHP] Extra spacing with br in HTML

2002-07-28 Thread Kevin Breit

On Sun, 2002-07-28 at 04:04, Justin French wrote:
 I *think* you've got a typo -- you've said ln2br instead of nl2br i think.

Doh!  You got that right.

 Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
 something to the resulting code, like replacing /libr / with /li:
 
 ?
 $original = ulliBlar/li/ul;
 $new = nl2br($original);
 $new = str_replace('/libr /', '/li', $new);
 ?

Hmmm..you've got it backwards, but I see what you mean.  I'll tool
around with it tonight.

Thanks for the suggestion.

Kevin
-- 
Kevin Breit [EMAIL PROTECTED]


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




Re: [PHP] Extra spacing with br in HTML

2002-07-28 Thread Justin French

on 29/07/02 12:02 AM, Kevin Breit ([EMAIL PROTECTED]) wrote:

 Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
 something to the resulting code, like replacing /libr / with /li:
 
 ?
 $original = ulliBlar/li/ul;
 $new = nl2br($original);
 $new = str_replace('/libr /', '/li', $new);
 ?
 
 Hmmm..you've got it backwards, but I see what you mean.  I'll tool
 around with it tonight.

I don't think I did

Manual Quote:

Description
mixed str_replace ( mixed search, mixed replace, mixed subject)

So, we search for /libr / (the problem being the unnecessary br /, and
replace it with /li.

Unless I'm misunderstanding the question/problem.


Justin


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




Re: [PHP] Extra spacing with br in HTML

2002-07-28 Thread Kevin Breit

On Sun, 2002-07-28 at 10:14, Justin French wrote:
 on 29/07/02 12:02 AM, Kevin Breit ([EMAIL PROTECTED]) wrote:
 
  Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
  something to the resulting code, like replacing /libr / with /li:
  
  ?
  $original = ulliBlar/li/ul;
  $new = nl2br($original);
  $new = str_replace('/libr /', '/li', $new);
  ?
  
  Hmmm..you've got it backwards, but I see what you mean.  I'll tool
  around with it tonight.
 
 I don't think I did
 
 Manual Quote:
 
 Description
 mixed str_replace ( mixed search, mixed replace, mixed subject)
 
 So, we search for /libr / (the problem being the unnecessary br /, and
 replace it with /li.
 
 Unless I'm misunderstanding the question/problem.
Oh wait, you're right!

Kevin
-- 
Kevin Breit [EMAIL PROTECTED]


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




[PHP] Extra spacing with br in HTML

2002-07-27 Thread Kevin Breit

Hey guys,
I am using a textarea to pass information to PHP.  I want to be able to
include HTML tags inside the text area.  I am using ln2br() to properly
convert line breaks to HTML.  This is where my issue comes up.

Lets say I have

ul
  liBlar/li
/ul

ln2br() will crunch that and put out:
ulbr /
  liBlar/libr /
/ulbr /

That creates a lot of white space when that HTML is rendered.  How do I
tell PHP not to put line breaks in a situation like that?

Thanks!
-- 
Kevin Breit [EMAIL PROTECTED]


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




Re: [PHP] Extra spacing with br in HTML

2002-07-27 Thread Jason Stechschulte

On Sat, Jul 27, 2002 at 08:08:34PM -0400, Kevin Breit wrote:
 Lets say I have
 
 ul
   liBlar/li
 /ul
 
 ln2br() will crunch that and put out:
 ulbr /
   liBlar/libr /
 /ulbr /
 
 That creates a lot of white space when that HTML is rendered.  How do I
 tell PHP not to put line breaks in a situation like that?

There might be an easier way, but you might just have to write your own
code for this.  Something along the lines of: (completely untested)

?php
$line = ereg_replace((^li|^ul|^ol)\n, br /\n, $line);
?

-- 
Jason Stechschulte
[EMAIL PROTECTED]
http://www.ypisco.com
--
The brain is a wonderful organ; it starts working the moment you get up
in the morning, and does not stop until you get to school.

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