Re: ereg() violence
| From: | Jesse Binam | Date: | Wed, 08 Nov 2000 04:50:33 +0000 |
| Subject: | Re: ereg() violence | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24261@lists.php.net to get a copy of this message | ||
Maxim -
I appreciate your feedback.
my understanding of this thusfar is that it turns html tags into text by
replacing characters like < with >
Am I wrong?
What I am doing is making a mailing list app. When the author write the
message they will choose whether
the message is text or html. If it is text it sends it out. If it is html it
needs to make a text version of the page to
send to the members of the list that have requested text only messages. So I
wouldn't want to change < to >
I want to change this:
<font color="FF0000" face="Verdana">HELLO WORLD & OTHER
PEOPLE</font><br>
<br>
<img src="image.jpg">
into this:
HELLO WORLD & OTHER PEOPLE
<<image.jpg>>
This is should be so easy. I would have thought that there would be an
html2text() function or something to
do this. I am sure that other people have done this I just can't find any
other programs that do this.
Jess
----- Original Message -----
From: Maxim Maletsky <maxim.maletsky@japaninc.net>
To: 'Jesse Binam' <sirbinam@xmission.com>; <php-general@lists.php.net>
Sent: Tuesday, November 07, 2000 9:19 PM
Subject: RE: [PHP] ereg() violence
> You can use HTML_ENTITIES,
>
> $trans = get_html_translation_table(HTML_ENTITIES);
> $trans[" "] = " ";
> $html = strtr($original, $trans);
>
> this will transform every HTML-looking tag into the format that you can
see
> on a vebsite,
>
> then you adding and adding
> ereg()
> # after
> ereg()
>
> can fix other issues..
>
> Cheers
>
>
> -----Original Message-----
> From: Jesse Binam [mailto:sirbinam@xmission.com]
> Sent: Wednesday, November 08, 2000 1:10 PM
> To: php-general@lists.php.net
> Subject: [PHP] ereg() violence
>
>
> I have been screwing with this thing for 7 hours and CANNOT get it to
work.
>
> When the author submits an html message the script needs to:
> replace tags like <br>, <p>, <div> with \n
> replace HTML codes with text equivelent like & with &
> strip all other HTML tags that have no place in a text message like <b>,
> <font>, etc.
> and it would be nice if it would find the img tags and replace them with
> something like
> <<http://www.isp.com/images/pic.jpg>>
>
> But I am running into some serious problems!!
> Either I can't get the regular expression right or it times out (possibly
> because the regular expression is wrong)
> I just don't know what to do. I think it would increase performance IF I
> could somehow code it to replace only
> what is there instead of searching for a every possible code whether it is
> there or not.
>
> Suggestions on this would be GREATLY appreciated
>
> Jess
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>