Re: [PHP] Problems with string replacement

2001-03-12 Thread Christian Reiniger

On Sunday 11 March 2001 23:44, you wrote:
> >> Well, I'm having problems again.  This time with string replacement.
> >> I'd like people to be able to write notes on one of the site's I'm
> >> helping with, and would like them to be able to use Bold, Italic,
> >> Underline and  tags.  I tried using striptags(); but that
> >> would strip anything within double quotes too.  So I've gotten
> >> around it by
> >
> > huh? strip_tags works fine for me.
> >
> > echo strip_tags ('Hello http://foo/">bar
> > "world"there', ' ');
> >
> > creates
> >
> > 'Hello http://foo/">bar "world"there'
>
> True, but then it doesn't:
> -Open the link in a new window

??
You have some tag like
http://foo.bar/" target="_new">link
and strip_tags() transforms this to
http://foo.bar/">link
?

Or what do you mean with that?

> it does:
> -remove all content between "and".

No. Just plain no. See my example above. The stuff in quotes was kept 
without any problems.

> Of course, I could replace quote marks with htmlspecialchars/entities
> or using manual string replacement, but then it'd render all tags using
> quote marks invalid.
>
> See the problem? ;)

No ;)
Perhaps if you could provide some example code...

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Error 032: Recursion error - see error 032

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problems with string replacement

2001-03-11 Thread James, Yz

>> Well, I'm having problems again.  This time with string replacement.
>> I'd like people to be able to write notes on one of the site's I'm
>> helping with, and would like them to be able to use Bold, Italic,
>> Underline and  tags.  I tried using striptags(); but that would
>> strip anything within double quotes too.  So I've gotten around it by

> huh? strip_tags works fine for me.

> echo strip_tags ('Hello http://foo/">bar
> "world"there', ' ');

> creates

> 'Hello http://foo/">bar "world"there'

True, but then it doesn't:
-Open the link in a new window
it does:
-remove all content between "and".

Of course, I could replace quote marks with htmlspecialchars/entities or
using manual string replacement, but then it'd render all tags using quote
marks invalid.

See the problem? ;)

James.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problems with string replacement

2001-03-11 Thread Christian Reiniger

On Sunday 11 March 2001 18:45, you wrote:

> Well, I'm having problems again.  This time with string replacement. 
> I'd like people to be able to write notes on one of the site's I'm
> helping with, and would like them to be able to use Bold, Italic,
> Underline and  tags.  I tried using striptags(); but that would
> strip anything within double quotes too.  So I've gotten around it by

huh? strip_tags works fine for me.

echo strip_tags ('Hello http://foo/">bar 
"world"there', ' ');

creates

'Hello http://foo/">bar "world"there'

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problems with string replacement

2001-03-11 Thread James, Yz

Hello all,

Well, I'm having problems again.  This time with string replacement.  I'd
like people to be able to write notes on one of the site's I'm helping with,
and would like them to be able to use Bold, Italic, Underline and 
tags.  I tried using striptags(); but that would strip anything within
double quotes too.  So I've gotten around it by converting the message
string to htmlspecialchars and then using ereg_replace around the tags I'd
like to allow, ie:

$message = ereg_replace("","", $message);

Where I'm struggling is with the a href tags, though.  I've been using this:

$message = eregi_replace("()(.*)(<\/a>)", "\\4", $message);

which would change a string containing:
http://www.php.net">PHP!
to:
http://www.php.net" target="_blank">PHP!

Great.  But, there's a problem.  If someone uses:
http://www.php.net" target="_blank">PHP!http://www.php.net" target="_blank">PHP Again!
it returns:
http://www.php.net" target="_blank">PHP!/a>