Re: transforming an HTML Comment in a HTML TAG
| From: | Toby Butzon | Date: | Mon, 15 Jan 2001 03:31:11 +0000 |
| Subject: | Re: transforming an HTML Comment in a HTML TAG | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34551@lists.php.net to get a copy of this message | ||
I think the ! might have an effect on the regexp interpretter... it's easy
enough to escape it (\!) though.
--Toby
----- Original Message -----
From: "Jason Murray" <Jason.Murray@melbourneit.com.au>
To: "'Romulo Roberto Pereira'" <php@diffdev.com>; "php-general"
<php-general@lists.php.net>
Sent: Sunday, January 14, 2001 10:24 PM
Subject: RE: [PHP] transforming an HTML Comment in a HTML TAG
> > So, before the end HTML comment I would like to add an image.
> > How do I do that?
>
> The first thing I suggest you do is use a comment for starting and a
> comment for ending - this makes it all a LOT easier to parse.
>
> Start: <!-- TEXT STARTS -->
> End: <!-- TEXT ENDS -->
>
> Then, you get your complete text into $buffer and just:
>
> <?
> $endtag = "<!-- TEXT ENDS -->";
> $imgtag = " <a href='edittext.php?pageid=X'>"
> ."<img src='images/edit_buttom.gif'></a>";
> $output = ereg_replace($endtag, $imgtag.$endtag, $buffer);
> ?>
>
> ... or something similar. Not sure if < or > or ! play havoc with a
> regex or not...
>
> If you can't change your start and end comments to be unique, then
> you'll have to just do the ereg_replace on every second one.
>
> Jason
>
> --
> Jason Murray
> jasonm@melbourneit.com.au
> Web Design Team, Melbourne IT
> Fetch the comfy chair!
>
> --
> 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
>
>