Re: Re: Eval a file, and it gives parse error because it uses a preg_match statement with \$
| From: | Josh Acecool M | Date: | Fri, 06 Aug 2004 11:24:25 +0000 |
| Subject: | Re: Re: Eval a file, and it gives parse error because it uses a preg_match statement with \$ | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192953@lists.php.net to get a copy of this message | ||
You dont understan..
Say the template is:
Blah
{CONTENT}
adasdasd
I want to preg_replace("/{CONTENT}/", include("blah.php"), $text);
blah.php contains Hello!
This is what appears
Hello!
Blah
adasdasd
"Curt Zirzow" <php-general@zirzow.dyndns.org> wrote in message
news:20040806005318.GU6522@bagend.shire...
> * Thus wrote Josh Acecool M:
> >
> > but, I am doing this.
> >
> > $text = file_get_contents('templateFile.php');
> > $text = preg_replace('/something/',
> > file_get_contents("something.php"),
> > $text);
> > eval("?>" . $text . "<?")
>
> This is rather an odd thing to do, kinda like taking an html
> document converting it to xml, add an element, then turning it back
> to html.
>
> To get around your \$ problem..
> see http://php.net/preg_quote
>
>
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid
schemes
> you've been hearing about. No, sir. Our model is the trapezoid!