Re: [SMARTY] Writing output from a template instead of displaying....
| From: | Raul Carvalho | Date: | Wed, 30 Jul 2003 07:23:41 +0000 |
| Subject: | Re: [SMARTY] Writing output from a template instead of displaying.... | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9994@lists.php.net to get a copy of this message | ||
Hi,
> (...) I need to write the output from a smarty generated html
> document to a flat .html file (...)
I am doing this myself; use the following code sample:
// Do some stuff ...
.
.
.
// Finally, capture Smarty output to a file
$output = $smarty->fetch('template.tpl');
$fn = "somefile.html";
$fp = fopen($fn,"w");
fwrite($fp, $output);
fclose($fp);
// Do something with the file...
header("Location: $fn");
// End of script
exit;
Hope this helps,
Raul