Re: Revisiting output control code
| From: | Xuefer | Date: | Tue, 07 Mar 2006 03:12:10 +0000 |
| Subject: | Re: Revisiting output control code | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-22161@lists.php.net to get a copy of this message | ||
is there any chance that a buffer in output buffer will be supported?
supposing u're implementing "send the whole page in html to friends"
function. using smarty as email template.
if (isset($_GET['send_html_to'])) {
ob_start('send_as_html');
}
function send_as_html($content)
{
$tpl = new Smarty("html_email");
prepair_html($content);
$tpl->assign($html, $content);
$content = $tpl->fetch(); <- this use ob_start to catch all output
from the compiled template
}
q: why not do "$content = ob_get_clean() and $tpl->fetch() after it"
in this case?
a: because i can't put ob_get_clean() code in all the php pages.
q: but u can do ob_start('send_as_html') in all pages? because i can
put it in a common lib that every page include.