RE: RE: [SMARTY] RE: [PEAR] Pear::Auth and Smarty
| From: | Simon H | Date: | Tue, 17 Dec 2002 09:09:54 +0000 |
| Subject: | RE: RE: [SMARTY] RE: [PEAR] Pear::Auth and Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6855@lists.php.net to get a copy of this message | ||
Thanks to both of you for following up on this, but I now have more
questions...lol.
Firstly, I would prefer to not have the $smarty->display within the
myAuth class, but rather keep it within my index.php. Is this possible,
or even recommended?
Also, why do you need to recycle the Smarty objects anyway? My
knowledge of OO PHP is a bit lacking!
Last question...would it make more sense to extend the Smarty Class with
myAuth (or a version of)?
Thanks again for the help guys! I'll have a look at the recycler and
see if I can figure it out...:-)
Simon H
> -----Original Message-----
> From: LIMBOURG Arnaud [mailto:arnaud.limbourg@cegetel.fr]
> Sent: Tuesday, December 17, 2002 7:57 AM
> To: anders.janson@mailbox.swipnet.se; Simon H; 'Smarty-General'
> Subject: RE: RE: [SMARTY] RE: [PEAR] Pear::Auth and Smarty
>
>
> > 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 ? ;))
>