Re: str_replace an include
| From: | J Smith | Date: | Tue, 21 Jan 2003 15:16:17 +0000 |
| Subject: | Re: str_replace an include | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132419@lists.php.net to get a copy of this message | ||
I'd recommend looking at the output buffering functions. Something like this
would probably work...
ob_start();
include("links.php");
$file = ob_get_contents();
ob_end_clean();
The result of parsing and executing links.php will be in $file. Do with it
what you will.
J
Jesse wrote:
> Hello all,
>
> I'm trying to replace a tag with an include in a template scenario. For
> example:
>
> str_replace("<!--linkTag--!>", include "links.php", $string);
>
> This obviously doesn't work, but I'm wondering if anybody knows of a
> good way to do this.
>
> Thanks a bunch,
>
> Jesse Lawrence