Re: Config object and variable scopes

From: Date: Tue, 09 Oct 2001 16:32:37 +0000
Subject: Re: Config object and variable scopes
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1649@lists.php.net to get a copy of this message
On Tue, 09 Oct 2001, Hans-Peter Oeri wrote: > Of course, everyone can have a look at it (I will place it on my web > server), but as it is an incompatible change in the file format, it will > never be included in smarty. I therefore suggest declaring the _conf_obj > attribute as public, so that OTHER implementations of config file objects > may be handled in a defined way (by assigning the object manually). What stops you from assigning to _conf_obj if you want to? > b) fallback for variable scopes > > I never really liked the distinction between config file vars and "other" > vars (assigned by the script or in the template). Indeed, I would > appreciate the possibility to "quickly" overwrite a config file variable. > > I therefore changed my compiler class to translate $-variables into: > $output = "(isset(\$this->_tpl_vars['$var_name']$output) ? ". > "\$this->_tpl_vars['$var_name']$output : ". > "\$this->_config[0]['$var_name']$output)"; > > Like that, I have: > $var = assigned "var", with fallback config "var" > #var# = config "var" only > > I could let the compiler class enable/disable the fallback behaviour for > backwards compatibility. However, I officially suggest the inclusion of > such an (optional) fallback behaviour. No, I don't believe something like this should be in Smarty, even if it's optional. There is a reason for separation of config and application variables -- similar to the reason is for separation of form and content. -Andrei "Then again, e=mc^2 may only be a local phenomenon." -- Einstein

« previous php.smarty.general (#1649) next »