Template pool class
| From: | anders dot janson at mailbox dot swipnet dot se | Date: | Mon, 19 Nov 2001 21:44:25 +0000 |
| Subject: | Template pool class | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-1980@lists.php.net to get a copy of this message | ||
This class is helpful if your app is like mine - you need several Smarty objects concurrently, but
you don't know how many, and you don't want to create a bunch of global objects "just
in case". AND you don't want to create temporary Smarty objects in your functions.
This class dynamically creates 'global' Smarty objects when they are needed, and lets you
recycle them when you don't need them anymore. Everything is encapsulated in the
class/namespace TPL, but I could have done it with global functions just as well.
Usage:
include "class.tpl.php";
:
:
$smarty = & TPL::alloc();
:
:
TPL::free($smarty);
Look at code: http://qualitum.com/Smarty/class.tpl.phps
Download:
http://qualitum.com/Smarty/class.tpl.php.txt
Feedback appreciated!
/Anders
-------------------------------------------------
WebMail från Tele2 http://www.tele2.se
-------------------------------------------------