Réf. : [SMARTY] page generated in 0,35 sec

From: Date: Mon, 31 Mar 2003 12:57:08 +0000
Subject: Réf. : [SMARTY] page generated in 0,35 sec
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9006@lists.php.net to get a copy of this message
> Hello is it possible to get this on every page ? > I can't find anything bout that in the manual in all your templates: {include file="time_to_compile.tpl"} and in time_to_compile.tpl: ---------------------------------- page generated in 0,35 sec and here you go :-) More seriously, you can use this class in your PHP files. // timer class class Timer { var $startTime, $endTime, $timeDifference; function start() { $this->startTime = $this->currentTime(); } function finish() { $this->endTime = $this->currentTime(); } function getTime() { $this->timeDifference = $this->endTime - $this->startTime; return round($this->timeDifference, 5); } function currentTime() { list($usec, $sec) = explode(' ',microtime()); return ((float)$usec + (float)$sec); } } // end timer class Then you assign the time to a template variable and display it in your templates... I do, and it works fine :-) Take care, Phil.

« previous php.smarty.general (#9006) next »