Re: [SMARTY] Re: Template execution time
| From: | Eaden McKee | Date: | Mon, 12 May 2003 16:10:45 +0000 |
| Subject: | Re: [SMARTY] Re: Template execution time | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9525@lists.php.net to get a copy of this message | ||
pt2002 wrote:
Hi, thanks for your answers but my problem isn't really measure the time. I have a "timer" class to do that. The problem is how to force Smarty always measure script execution even if the template is cached. I can do: $ini = time(); $tpl = new Smarty(); if (!is_cached("test.tpl") { $tpl->assign("var1", "xpto") ... } $tpl->display("test.tpl");I use At the top : $mtime = explode(" ",microtime()); $begintime = $mtime[1] + $mtime[0]; function buildfoot() { global $begintime $mtime = explode(" ",microtime()); $endtime = $mtime[1] + $mtime[0]; $pagetime = round($endtime - $begintime,5); $foot = "\n<!--// This page took $pagetime seconds to make //-->\n"; return $foot; } then // smarty stuff. // $Smarty->display("page.html"); then at the bottom of your php file after the call to $smarty->display() : echo buildfoot(); Eaden.