RE: [SMARTY] non-existance variables (one idea)
| From: | Josh Johnson | Date: | Mon, 14 Oct 2002 12:31:01 +0000 |
| Subject: | RE: [SMARTY] non-existance variables (one idea) | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6131@lists.php.net to get a copy of this message | ||
That solution is unideal if case you ever want to upgrade... you'll also
have to check all of the other plugin functions to ensure that it
doesn't create an undesired result. You may want to just extend the
class and redefine that method (_parse_var). You'll still need to take
some time to be sure it doesn't adversely affect the use of other
functions, but you could upgrade without any extra hassle.
Maximum error reporting is only intended for use in development
environments... Honestly, since PHP doesn't require that variables are
declared before use, I think it's excessive to worry about the errors.
I'd recommend using ini_set("error_reporting", "your desired level") as
needed, when things aren't working properly, and otherwise keep the
level very low (I can't remember the setting, but it will only echo
fatal errors).
Since your relying on smarty to handle variables, and smarty is intended
for display of dynamic webpages, why does it matter? The whole point of
a template system is to keep PHP out of the layout... but you're
willfully exposing unnecessary errors to the user?
Another question that comes to mind is: "why *are* you using variables
that haven't been declared already (it's as simple as
$smarty->assign())?"
I'm curious to see the exact error that you get, and the situation where
you run into it.
Make sure you're using error reporting for debugging, not to be l33t :)
-- Josh
-----Original Message-----
From: Pupeno [mailto:pupeno@pupeno.com]
Sent: Monday, October 14, 2002 5:38 AM
To: smarty-general@lists.php.net
Subject: Re: [SMARTY] non-existance variables (one idea)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Well, by just adding this line:
$output = "isset($output) ? $output : NULL";
to the end of the Smarty_Compiler::_parse_var($var_expr) function (line
1161,
before the parse modifiers call) it solved the problem and it seems it
doesn't break functinality, but I may be wrong, does it ?
You may argue that this makes the resulting scripts slower, yes, that's
true,
if that's really important, is it posible to make this optional (by a
configuring variable or something like that ?)
Thank you.
- --
Pupeno: pupeno@pupeno.com
http://www.pupeno.com
- ---
Help the hungry children of Argentina,
please go to (and make it your homepage):
http://www.porloschicos.com/servlet/PorLosChicos?comando=donar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9qpCKLr8z5XzmSDQRAgCGAJ9nib5WfkohmUqZr5YVCXAydA3k8gCgzfmF
DADfw8A/BPCFTEh7v6C3amg=
=NxXB
-----END PGP SIGNATURE-----
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php