RE: RE: [SMARTY] RE: [PEAR] Pear::Auth and Smarty
| From: | LIMBOURG Arnaud | Date: | Tue, 17 Dec 2002 07:56:44 +0000 |
| Subject: | RE: RE: [SMARTY] RE: [PEAR] Pear::Auth and Smarty | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6854@lists.php.net to get a copy of this message | ||
> I think I know what that is :-)
>
> Some time ago, I wrote a class that recycles Smarty objects.
> That's the one. I know Arnaud used it, but I don't know if he
> has modified it.
>
> You'll find my original code at:
> http://www.qualitum.com/Smarty/class.tpl.php.txt
>
> /Anders
I did modify it a wee bit.
function &alloc()
{
global $TPL_currAllocCount ;
global $TPL_maxAlloc ;
global $TPL_count_all ;
global $TPL_pool ;
$TPL_count_all++ ; // Smarty
objects counter
$TPL_currAllocCount++ ; // Currently
allocated objects
if (@count($TPL_pool) == 0) // Out of objects.
Create one more.
{
$TPL_maxAlloc++ ; //
Remember peak index
$smarty = & new Smarty ;
}
else
{
$smarty = array_pop($TPL_pool); // Recycle old
template from pool
}
$smarty->_tpl_vars = array();
$smarty->Smarty();
return $smarty;
}
As you can see i added those two lines
$smarty->_tpl_vars = array();
$smarty->Smarty();
Because I had problems with variables which stayed in the object (as is
proper but it took me a while to find out ;)
How are you Janson, your cms project still alive ? ;))