Re: Trying to create a site-template system.. and..
| From: | Moody | Date: | Sun, 28 Oct 2001 22:19:39 +0000 |
| Subject: | Re: Trying to create a site-template system.. and.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72647@lists.php.net to get a copy of this message | ||
Try this: (see http://www.php.net/manual/en/ref.outcontrol.php
for more
info)
> > My problem is.. that when I do something like
> >
> > ---------------------------------------------
> > $content = show_source("/path/to/file");
> > // or
> > $content = "Blah.. blah.. ".include("/some/file").".. some
> > more blah..";
> > ---------------------------------------------
> >
> > It includes the files (or executes the code that is assigned
> > to the variable), however it all appears OUTSIDE the
> > template.
ob_start(); // start buffer
eval("?>".include ("/path/to/file"));
$file_content = ob_get_contents();
ob_end_clean(); // delete the buffer
$content = "Blah.. blah.. ".$file_content.".. some more blah..";
Hope this helps...