Re: [SMARTY-DEV] Question regarding constants
[email protected] (Robby Russell)
| Newsgroups | php.smarty.dev |
|---|---|
| Organization | PLANET ARGON |
| Message-ID | <1094013857.4549.81.camel@vacant> |
On Tue, 2004-08-31 at 16:28, boots wrote: > --- Robby Russell <[email protected]> wrote: > > At the top of Smarty.class.php you set a few constants. > > > > Well, I have an app that now calls Smarty once typically, but there > > is a > > scenario where it calls another instance of Smarty within a function > > that might take a bit of work to get the code built to pass the > > object into this other process. > > In general, you should try to stick to one instance. Even so, if you > are using require_once, then you oughtn't be having any problems with > the redeclarations. In fact, if you are doing otherwise, I'm surprised > that you aren't having problems with the class being redeclared. > > > We were getting an error with the constants being redefined and I > > changed them to: > > You can probably get away with: > if (!defined('SMARTY_PHP_PASSTHRU')) { > define('SMARTY_PHP_PASSTHRU', 0); > define('SMARTY_PHP_QUOTE', 1); > define('SMARTY_PHP_REMOVE', 2); > define('SMARTY_PHP_ALLOW', 3); > } > > But again, this shouldn't be required. It is also important to note > that with the possible exception of SMARTY_DIR, Smarty expects to be > able to define the SMARTY_* constants, for one thing, to prevent > tampering. If you are defining them yourself, don't. > > xo boots Thanks. I am not tampering with them. I only questioned why there are not checked to be have been already defined before defining them. You have one of them that has a check at the top, but the next 4 are not. So, was curious. I already added a check like this in place on my local copy but this app runs on a few machines and until I get a chance to work on the code that calls smarty again, was wondering if possible to add these checks to future versions. ;-) Would it affect the load time of a smarty object/file? Curious, -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [email protected] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development ****************************************/
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBBNVOh0QaQZBaqXgwRAjazAJ0etkaqsMr30wXXm2Wik8ZOWDNLKgCgheJt xn8LrjMMyB3xKiLb1NaQZ3k= =2cvx -----END PGP SIGNATURE-----