patch for run function
| From: | Tom Sommer | Date: | Sun, 02 Mar 2003 01:55:56 +0000 |
| Subject: | patch for run function | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-880@lists.php.net to get a copy of this message | ||
Only one thing is lacking in smarty (IMO), the ability to assign variables
just before displaying a page, this patch is a starter for such a function
What this is used for is to display things such as execution time etc.
Here is an example of what a function could do
function smarty_runfunction_setexecutiontime (&$smarty)
{
global $time_start;
$smarty->assign('PARSETIME', round(getmicrotime() - $time_start,5));
}
Each time a template is _displayed_ ( $smarty->display() ) these variables
will be set.
Things such as number of MySQL queries etc can also be included
Anyway, consider this patch... I will be happy to have any comments
The reason I made this is because I need it, and I've heard some other
people also need it also
PS. No need to say this function is NOT run when smarty is doing cached
pages :)
PATCH: http://dev.tsn.dk/smarty.patch.runfunction.txt
Any comments?
--
Tom Sommer, denmark
www.tsn.dk - www.dreamcoder.dk