Josh Acecool M wrote:

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

That's exactly what's supposed to happen. PHP encounters your preg_replace line. Within that line, before any output, PHP encounters your include() statement. So, it includes the file, sends it as output, returns nothing and then goes back to your preg_replace. It then replaces {CONTENT} with the nothing returned from include() and returns the result.


What are the _exact results_ when you use file_get_contents()?

$output = preg_replace('/\{CONTENT\}/',file_get_contents('blah.php'),$text);

--

John Holmes

php|architect - The magazine for PHP professionals - http://www.phparch.com

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



Reply via email to