[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-dev
Subject:    [SMARTY-DEV] Re: [SMARTY] Dynamic Constants (config)
From:       messju mohr <messju () lammfellpuschen ! de>
Date:       2003-02-27 9:24:43
[Download RAW message or body]

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

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic