Re: [SMARTY] Dynamic Constants (config)

From: Date: Thu, 27 Feb 2003 09:24:43 +0000
Subject: Re: [SMARTY] Dynamic Constants (config)
References: 1 2  Groups: php.smarty.dev php.smarty.general 
Request: Send a blank email to php-smarty-dev+get-851@lists.php.net to get a copy of this message
On Thu, Feb 27, 2003 at 09:56:52AM +0100, Hinrich Donner wrote: > > No hints on this topic? hmm, i think i found a bug. normally you should be able to access your config-vars also as {$smarty.config.name} this feature was added recently to smarty. so in theory you can build your config-var-name into a variable {assign var="error_name" value="ERROR_TEXT_$error_code"} and then access it. {$smarty.config.$error_name} but the compiler produces <?php echo $this->_config[0]['vars']["$name"]; ?> which should read <?php echo $this->_config[0]['vars']["".$this->_tpl_vars['name'].""]; ?> the same is for {$smarty.const.$variable}, which worked great a few weeks ago, AFAIR. does anybody know about recent changes in the $indexes array that is passed to Smarty_Compiler::_compile_smarty_ref(&$indexes) ??? i think if this bug is fixed, my example above should solve your problem. have fun messju > On Wednesday 26 February 2003 13:41, Hinrich Donner wrote: > > > Hi, > > > > I like to use the config_load for a multi language feature. To handle this > > in some special cases (e.g. error messages), I'm looking for a possibility > > to join a variable and a constant, for example: > > > > {if $error_code neq 0} > > <span class="error"> > > <h1>{#ERROR_TITLE#}</h1> > > <p>{#ERROR_TEXT_$error_code#}</p> > > </span> > > {/if} > > > > In that example the error code has an integer value. In the config file > > the constants are defined for example: > > > > ERROR_TITLE="Error" > > ERROR_TEXT_1="File not found." > > ERROR_TEXT_2="Fille access not allowed." > > ERROR_TEXT_3="Foo your bar." > > > > [de] > > ERROR_TITLE="Fehler" > > > > I hope, you understand what I like to do. > > > > Thanks for any help > > Hinrich > > -- > Hinrich Donner > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- voll konfigurierbar: nicht vorinstalliert. Peter Berlich

« previous php.smarty.dev (#851) next »