Re: [SMARTY-DEV] Re: [SMARTY] Dynamic Constants (config)
| From: | messju mohr | Date: | Thu, 27 Feb 2003 18:07:48 +0000 |
| Subject: | Re: [SMARTY-DEV] Re: [SMARTY] Dynamic Constants (config) | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8273@lists.php.net to get a copy of this message | ||
On Thu, Feb 27, 2003 at 10:24:43AM +0100, messju mohr wrote:
> 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'].""];
> ?>
i don't know if you read smarty-dev: it was stated there that the
problem above is fixed in the cvs-version. so you can try my above
suggestion with that version. i don't know any way to it with 2.4.2.
HTH
messju
> 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
--
voll konfigurierbar: nicht vorinstalliert.
Peter Berlich